i stumbled random issue... here code
mspeechrecognizer = speechrecognizer.createspeechrecognizer(mcontext); initializerecognitionlistener(); mspeechrecognizer.setrecognitionlistener(mrecognitionlistener); intent intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model, recognizerintent.language_model_free_form); intent.putextra(recognizerintent.extra_calling_package, getclass().getpackage().getname()); intent.putextra(recognizerintent.extra_language, "en-us"); intent.putextra(recognizerintent.extra_speech_input_complete_silence_length_millis, long.valueof(3000l)); intent.putextra(recognizerintent.extra_max_results, 5); mspeechrecognizer.startlistening(intent);
method initializerecognitionlistener():
private void initializerecognitionlistener() { mrecognitionlistener = new recognitionlistener() { @override public void onreadyforspeech(bundle params) { log.d("onreadyforspeech()", "onreadyforspeech!"); isrecognizing = true; } @override public void onbeginningofspeech() { log.d("onbeginningofspeech()", "onbeginningofspeech!"); } @override public void onendofspeech() { log.e("onendofspeech()", "onendofspeech! stop sco"); } ... }
main issue "onreadyforspeech()" , "onbeginningofspeech()" methods sometimes doesn't called after mspeechrecognizer.startlistening(intent). "onendofspeech()" can not called.
i'm using nexus 4 android 4.2.2
i posted similar answer on post:
this google voice search/jelly bean bug has been outstanding on aosp bug tracker year.
i posted on google product forum here too, no response. if reading , these issues resolved, please star aosp issue , comment on product forum post noticed!
to work around issue, you'll need implementation such 1 demonstrated here.
in testing today, appear latest version of google search has fixed problem internally though - update google search on play store , problem may disappear - if that's not case you, please comment below, may fixed in versions of google search apk, in case helpful know these variations occur handle them gracefully in our code!
Comments
Post a Comment