0
votes

I am using a guide on creating contextual voice commands from within my Glassware (basically a custom 'okay glass' menu inside your own app), listed below. I have been patterning part of my Glassware off this example very closely, and have even triple-checked that I followed the steps correctly, but have been experiencing unexpected behavior.

https://developers.google.com/glass/develop/gdk/voice#contextual_voice_commands

When I say "ok glass", the menu items are displayed as white text with transparent backgrounds overlaid onto my content view (which is a GLSurfaceView subclass, not that it should be relevant). When I speak a command that is a regular menu item, it works as intended. However, when I speak a command which contains a submenu, the submeu items appear in a popup list with text on an opaque background. This popup list does not respond to voice, unlike its parent menu. The list only responds to a single tap which only allows you to choose the first item; there is no way to scroll the selection to any other item.

UPDATE: This statement:

Google's sample is a multi-level menu which is assumed to work, but they don't provide a downloadable sample source code for it so I can't confirm their example works as claimed. Has anybody else been unlucky with multi-level contextual voice menus?

Is no longer true. I started from scratch with a brand-new empty Android project targeted on Glass and this time I have copy/pasted Google's sample code by verbatim, and added the string resource values (which they didn't provide) so it will compile. I found that Google's sample code had the exact same bug!

2

2 Answers

1
votes

It's hard to say without seeing your code why the contextual voice command doesn't work in your app.

But their example does work. You can see my project based on that example at https://github.com/prt2121/ContextualVoiceCommands

Hope this helps.

1
votes

Well it looks like the bug is due to a careless, but hard to detect oversight on my part. I was running this project on a different type of wearable Android device previously and was using this in my AndroidManifest.xml under the application element:

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

For some reason I put this in my skeleton project too, probably getting this confused with the "No Theme" setting that GDK docs suggest. This was visibly working fine on Glass up until I started going into multi-level contextual voice menus.

Removing this altogether from the manifest fixed the issue.