RecognitionListener在软糖冻结,如果没有说过话马上软糖、说过、如果没有、RecognitionListener

2023-09-05 06:43:17 作者:你跟别人暧昧

一个语音识别基于应用程序,我的工作非常适用于所有版本的Andr​​oid从API 8(Android 2.2的)。启动

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

但在一个的Nexus S 4G(安卓4.1.1),RecognitionListener将简单的暂停约1分钟,然后发出通过其onError()回调。

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.

如果讲的是onReadyForSpeech哔哔),它会表现得正常预期。

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?

更重要的是,有没有办法让它表现得像在旧版本的Andr​​oid? (即守听,然后发出ERROR_SPEECH_TIMEOUT如果默认内没有说过话的10秒)

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)

推荐答案

我最终使用由 @scriptocalypse

感谢您@scriptocalypse!

Thank you @scriptocalypse!

(我还没有机会尝试通过 @HoanNguyen 提出的解决方案,因为它实现它是一个服务超出了我的小应用程序的范围,但它看起来很有希望。谢谢@HoanNguyen了。)

(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.)