I have an android app developed to run on the google glass. And I run it using the adb. is it possible to give configure a voice command so that I can trigger it by saying "Ok GLASS" + "My Command" ??
Activate Glass: Tap the touchpad to turn the display on. Swipe forward and back: Swipe forward to move right on your timeline, swipe backwards to move left through items on your timeline. To quickly navigate your timeline, swipe with two fingers, and you'll see a zoomed out view of the timeline.
Update - After XE16 update the following method does not work, the new solution is here Why is my voice command missing from the ok glass menu in XE16?
What you have to do is,
Inside the manifest file add these tags under the service which you wanted to trigger on your voice command.
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/voice_trigger_start" />
And you have to create a folder called xml inside res and add a xml file named as voice_trigger_start.xml
.
Inside that add these lines
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/its_me_amalan" />
Open the values folder inside the res
folder and edit strings.xml
, so it will look like this
<resources>
<string name="app_name">Amalan</string>
<string name="its_me_amalan">Hello Amalan</string>
<string name="stop">Stop</string>
</resources>
Now install the app onto Glass and say "ok glass, Hello Amalan" and the app opens.
Reference: http://pathofacoder.com/2013/11/20/google-glass-adding-your-own-voice-commands-to-your-apps/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With