0

I'm creating an Immersion with real-time content, and to avoid confusing the user, I'd like to pause and resume updating its UI while the user is interacting with the voice menu. The problem is that onPanelOpen() is called when the Activity is displayed, and onPanelClosed() is called when the Activity finishes.

Here are the questions:

  • How do I detect when the user says "ok glass"?
  • How do I detect when the user dismisses the contextual voice commands without selecting a menu item or dismissing the Activity? (ex. by swiping down after saying "ok glass")
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
Zack Freedman
  • 153
  • 1
  • 6

2 Answers2

0

I'm coming up against a similar problem and as far as I can tell, no callback is called on detection of 'ok, glass'. I followed steps similar to those described on this issue: Glass voice command nearest match from given list - Pull the APK mentioned (notice that it's moved location since to /system/priv-apps/) and then set up your own listener. It's certainly not an ideal situation; if you use gestures to pull up the menu instead of the voice command, various useful callbacks are triggered (onPreparePanel, onCreateOptionsMenu etc). Please share any findings if you've worked out a better solution since you posted the question!

(As for the second part (detecting the swipe down gesture), sorry I haven't tried detecting that yet)

Community
  • 1
  • 1
Manning
  • 21
  • 2
  • I reported the no callback issue on https://code.google.com/p/google-glass-api/issues/detail?id=583&can=4&colspec=ID%20Type%20Status%20Priority%20Owner%20Component%20Summary, please add you findings there, I guess that could help it to get noticed – user3542552 Aug 12 '14 at 20:14
0

Same here, there is no callback in XE 19.1 yet.

My solution :

To update the menu when I need (recreate the menu) : 
getWindow().invalidatePanelMenu(WindowUtils.FEATURE_VOICE_COMMANDS);

To catch exit of the the menu : 
Add "Cancel" in the menu, and do stuff in the onMenuItemSelected function if
Cancel is called
Pull
  • 2,236
  • 2
  • 16
  • 32