Create “ok glass” style menu, within glass app

后端 未结 4 1044
慢半拍i
慢半拍i 2021-02-02 03:08

I have just begun developing for Google Glass, and I knew the GDK if fairly new so this may not be possible yet, but here\'s what I\'m trying to to:

As with the \"make a

4条回答
  •  孤城傲影
    2021-02-02 03:43

    I found this answer from another SO question that seems exactly like you want. I have tried it myself for my own Glassware and it works perfectly. As mentioned in the answer below, one caveat that other apps that use the same "ok glass" voice command will share the submenu; in the following example, for instance, some other app may add other games such as "golf." Another potential problem is that you must have an Activity or Service for each of the options you want in the submenu.

    "If you have multiple activities/services installed on Glass that have the same voice trigger intent filter, all of their names (based on the android:label attribute of the or tag in AndroidManifest.xml) will appear in a disambiguation "submenu" when you speak that voice trigger.

    For example (assume that res/xml/play_a_game_trigger.xml represents a voice trigger for the string "play a game"):

    
        
            
        
        
    
    
        
            
        
        
    
    

    would give you a voice menu flow that looks like

    ok glass → play a game → Tennis
                             Bowling
    

    Do note, however, that this menu would also include activities/services from other APKs that use the same voice trigger as well.

    You can find more details at the Voice Input page of the GDK documentation."

提交回复
热议问题