2
votes

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?

1

1 Answers

0
votes

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.