Pregunta

Using this code snippet, as directed by Google's guide, presents an additional voice input screen.

<activity
    android:name="ca.lvin.myfirstglassapp.MyPuppiesSlideshowActivity "
    android:label="@string/app_name" >
    <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/my_voice_trigger" />
</activity>

What I want:

  1. "Ok, Glass"
  2. "Show me the pictures of puppies" (As per https://developers.google.com/glass/develop/gdk/ui/theme-widgets)
  3. MyPuppiesSlideshowActivity launches

What I'm getting:

  1. "Ok, Glass"
  2. "Show me the pictures of puppies"
  3. Microphone asking for more input is presented
  4. Say anything to the mic screen
  5. MyPuppiesSlideshowActivity launches

Can someone help me get rid of the two extra steps?

Related to this: Voice command for apps in Google Glass? but I couldn't comment on the original thread due to the lack of reputation...


Resolved!
I copied the code from this site verbatim
https://developers.google.com/glass/develop/gdk/input/voice

<trigger keyword="@string/glass_voice_trigger">
    <input prompt="@string/glass_voice_prompt" />
</trigger>

And the input tag was the problem. Removing it took care of the prompt.
Thank you!

¿Fue útil?

Solución

I can't be sure without seeing your voice trigger XML, but it sounds like you might have written the trigger to expect additional input by including this line:

<input prompt="@string/glass_voice_prompt" />

Remove that line from your trigger and it won't prompt you.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top