0

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!

staeryatz
  • 449
  • 4
  • 16

2 Answers2

1

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.

pt2121
  • 11,720
  • 8
  • 52
  • 69
  • Yesterday I tried the Google code in its own project (see my latest edit), and it has the same bug. Therefore seeing their code is sufficient.Thanks for your help, but I tried your app off GitHub and it builds, deploys, then crashes on launch for me. I am using Eclipse, and noticed right away the project structure I'm used to is much different than your gradle-built project. That's probably why the Java runtime can't find the MainActivity class. – staeryatz Sep 19 '14 at 17:45
  • yes, i used android studio. Can you share your code by any chance? It's easier to see what you might be missing. – pt2121 Sep 19 '14 at 18:02
  • 1
    also, my project on GitHub is more complete. So, instead of copy & paste Gdk doc, why don't you try c&p mine? – pt2121 Sep 19 '14 at 18:04
  • Android Studio is not an option for me because it doesn't yet have NDK support, which we need in order to support our own proprietary 3D renderer written in C++. And that is also the reason why I can't share the code. I will try your code in my skeleton project. Thanks. – staeryatz Sep 19 '14 at 18:12
  • Your code in my skeleton project also has the same bug. I am checking project settings now. – staeryatz Sep 19 '14 at 21:02
1

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.

staeryatz
  • 449
  • 4
  • 16