RecognitionListener in JellyBean Freezes if not spoken to immediately

旧街凉风 提交于 2019-12-04 19:33:33

问题


A speech-recognition based app I am working on works well on all versions of Android starting from API 8 (Android 2.2).

But on a Nexus S 4G (Android 4.1.1), RecognitionListener will simply halt for about 1 minute, then issue an ERROR_SERVER via its onError() callback.

If spoken to within 1-2 seconds (of that onReadyForSpeech bleep), it will behave properly as expected.

What changed in JellyBean that could explain this behavior?

More importantly, is there a way to make it behave like in the older versions of Android? (i.e. keep listening, then issue ERROR_SPEECH_TIMEOUT if not spoken to within the default 10 seconds)


回答1:


I ended up using the solution suggested by @scriptocalypse

Thank you @scriptocalypse!

(I haven't had the chance to try the solution suggested by @HoanNguyen because it implements a service which is beyond the scope of my tiny app, but it looks promising. Thank you @HoanNguyen, too.)




回答2:


There is a similar post here that offers the suggestion of simply listening again up on receiving ERROR_TIMEOUT_SPEECH result.



来源:https://stackoverflow.com/questions/14116724/recognitionlistener-in-jellybean-freezes-if-not-spoken-to-immediately

工具导航Map