2

With a regular Android application, one can have two buttons where one triggers some code and the other triggers different code. For example, with two methods called startCameraForRec() and startCameraForOCR(), I have this working in my Android application:

<Button
    android:text="@string/recognize"
    android:onClick="startCameraForRec" />
<Button
    android:text="@string/ocr"
    android:onClick="startCameraForOCR" />

How can I implement the same behavior in a Google Glass application with multiple voice commands? For example, right now I have:

<intent-filter>
            <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>

When I say a specific command, my application launches. Is there anyway I could set up a second command which launches the application at a different entry point? With buttons, this is trivial (each button can call a method). How can I do this with multiple voice commands in my Google Glass application?

Ben Sandler
  • 2,223
  • 5
  • 26
  • 36

1 Answers1

0

You can choose from the following checklist of voice commands that you can use in order to invoke a particular service in your glass app.

For the concern of having specific commands for your glass app, you can suggest Google three commands for a particular action. Please visit the following page and fill up the form to do so.

EDIT: For that you would require an additional permission. Add this to your manifest:

<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />

When you're ready to release your Glassware, you must use a built-in static voice command. XML for this kind of command would look more like this:

<?xml version="1.0" encoding="utf-8"?>
<trigger command="START_A_RACE" />

Where START_A_RACE is one of the items from this list. If none of the listed commands are appropriate for your Glassware, you can request one from the above link.

AniV
  • 3,997
  • 1
  • 12
  • 17
  • I don't think you understood my question. – Ben Sandler Jan 22 '15 at 06:22
  • If I am not wrong... You are asking about setting up your own voice commands in order to process information (eg. launch app) in your glass app... Is that correct? – AniV Jan 22 '15 at 19:00
  • Close, but not quite. I'm asking how to set **multiple** voice commands. I already have an app which works with just one. – Ben Sandler Jan 22 '15 at 23:58