Search code examples
androidgoogle-glassgoogle-gdk

Can't register voice trigger on glass


My glass app isn't able to find the "name" to use for the voice trigger. The command is showing up in the "ok glass... " list, but i get this exception when the app installs:

12-27 18:11:31.372      460-460/? W/VoiceTrigger﹕ Unable to get info for trigger: ComponentInfo{com.my_foo2/com.my_foo2.Glass.UiService}
android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.my_foo2/com.my_foo2.Glass.UiService}
        at android.app.ApplicationPackageManager.getServiceInfo(ApplicationPackageManager.java:253)
        at com.google.android.glass.app.VoiceTrigger.getInfo(VoiceTrigger.java:290)
        at com.google.android.glass.app.VoiceTrigger.loadLabel(VoiceTrigger.java:263)
        at com.google.glass.home.voice.menu.MainMenuGrammarLoader.getDisambiguationGraph(MainMenuGrammarLoader.java:124)
        at com.google.glass.home.voice.menu.MainMenuGrammarLoader.reloadDisambiguationConfigs(MainMenuGrammarLoader.java:77)
        at com.google.glass.home.voice.menu.MainMenuGrammarLoader.reloadGrammars(MainMenuGrammarLoader.java:73)
        at com.google.glass.home.voice.menu.MainMenuGrammarLoader.registerForUpdates(MainMenuGrammarLoader.java:137)
        at com.google.glass.input.VoiceInputHelper.registerGrammarLoaders(VoiceInputHelper.java:576)
        at com.google.glass.input.VoiceInputHelper.dispatchVoiceServiceConnected(VoiceInputHelper.java:571)
        at com.google.glass.input.VoiceInputHelper.access$400(VoiceInputHelper.java:41)
        at com.google.glass.input.VoiceInputHelper$2.handleMessage(VoiceInputHelper.java:171)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4424)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)

Here's the service declaration xml:

<service
        android:name=".Glass.UiService"
        android:label="@string/app_name"
        android:icon="@drawable/main_icon"
        android:enabled="true" >
        <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/sb_show" />
    </service>

i seem to be doing the same exact things as the code samples, but keep getting this exception. thoughts?

EDIT

sb_show.xml is

<trigger keyword="@string/show_voice_trigger"/>

and show voice trigger is my trigger string ("show blah")


Solution

  • So the issue seems to have been with the "disambiguation" part of the stack trace, and the exception itself doesn't seem to have mattered.

    The string was "record a ," and it seems to have confused the speech recognizer. "Record a video" continued to work, but the second I changed "record a " to "get a ," it started working fine.