2

Is it possible to give the user "hints" using voice trigger's input prompt? This is would be similar to what the action "make a call" displays, giving you a list of possible options.

For instance using the following...

<trigger keyword="@string/start_scan" >

    <constraints
        camera="true"
        network="true" />

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

</trigger>

I would like the user flow to be as follows...

------------
"Ok, Glass"
------------
"Scan"
------------
What would you like to scan?
QR Code
Product
Barcode
------------
"Barcode"
JRomero
  • 4,878
  • 1
  • 27
  • 49
  • I've found a work around based on this but it still isn't exactly what I want plus adds significantly to the manifest depending on options and must use a different method to detect selection in activity. http://stackoverflow.com/a/20125392/552902 – JRomero Dec 01 '13 at 15:27

2 Answers2

1

Found a workaround with a few cons:

  1. Bloats AndroidManifest depending on number of options.
  2. Different method of getting selected option.
  3. Can't be done programmatically.
  4. Workflow is more like...

    ---------
    "Ok, Glass"
    ---------
    "Scan"
    ---------
    ok glass, scan...
    QR Code
    Product
    Barcode
    ---------
    "Barcode"
    

Android Manifest:

    <activity android:name="com.cantilsoftware.barcodeeye.LaunchActivity">
    </activity>

    <activity-alias
        android:name="Product"
        android:label="Product"
        android:targetActivity="com.cantilsoftware.barcodeeye.LaunchActivity" >
        <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_scan" />
    </activity-alias>
    <activity-alias
        android:name="Barcode"
        android:label="Barcode"
        android:targetActivity="com.cantilsoftware.barcodeeye.LaunchActivity" >
        <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_scan" />
    </activity-alias>
    <activity-alias
        android:name="QR Code"
        android:label="QR Code"
        android:targetActivity="com.cantilsoftware.barcodeeye.LaunchActivity" >
        <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_scan" />
    </activity-alias>

Selection detection:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_launch);

    try {
        ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(), 0);
        processVoiceAction(activityInfo.loadLabel(getPackageManager()).toString());
    } catch (NameNotFoundException e) {
        e.printStackTrace();
        processVoiceAction(null);
    }
}
JRomero
  • 4,878
  • 1
  • 27
  • 49
0

Have you tried adding a line feed character (i.e. '/n') after the question mark in the prompt text to get a fresh new line?

straya
  • 5,002
  • 1
  • 28
  • 35
  • Haven't tried that, simple solutions escape me, but even if it worked and looked decently, it won't prevent the user from saying any word when in reality they should be limited to those 3 options. – JRomero Dec 02 '13 at 15:29