问题
In search for a way to implement contextual voice commands with Google's GDK i came across this post. Yet, the example code seems to work only in XE12 not in XE16+. I tested this code recently, but the onVoiceCommand(...)
method is only called once in the lifetime of a related Activity. My expectation would be that a user's voice command can be obtained multiple times, i.e., if a user returns to a certain Activity from another one.
I even tried to remove and reattach the Activity and/or Listener to the GDKs built-in VoiceInputHelper when the Activity is backgrounded via the onPause(...)
and onResume(...)
method, yet no success. Any helpful ideas why VoiceCommands are "gone" after one event and how they can be "reenabled"?
I can test your ideas/solutions as I have a Glass device at hand, and I verify any input rapidly.
回答1:
The original example in at stackoverflow.com/questions/21168267 needs a small change: to work continously null
needs to be returned in onVoiceCommand()
.
来源:https://stackoverflow.com/questions/23441199/why-does-glass-gdk-based-voicelistener-only-catch-voicecommand-once-in-xe16