Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Voice command for apps in Google Glass?

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" ??

like image 763
Amalan Dhananjayan Avatar asked Nov 20 '13 05:11

Amalan Dhananjayan


People also ask

How do you control Google Glass?

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.


1 Answers

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,

  1. 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" />
    
  2. And you have to create a folder called xml inside res and add a xml file named as voice_trigger_start.xml.

  3. Inside that add these lines

    <?xml version="1.0" encoding="utf-8"?>
    <trigger keyword="@string/its_me_amalan" />
    
  4. 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/

like image 186
Amalan Dhananjayan Avatar answered Sep 28 '22 12:09

Amalan Dhananjayan