SpeechRecognizer doesn't timeout when silent

2019-07-24 15:44发布

问题:

With the recent Google App update (6.14.20.21.arm), the google Speech recognizer stopped working. If you respond within seconds after the recognizer is started , the listener onResult is called. But if we don't respond, and there is no callback getting called. The onError callback used to call with SpeechRecognizer.ERROR_SPEECH_TIMEOUT

Is there anyone having this issue?

The same issue using the RecognizerIntent.ACTION_RECOGNIZE_SPEECH Intent . The onActivityResult is not called if no response . It use to timeout before and stopped working now.

This is how i'm starting the activity:

    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 , this.getPackageName());
    startActivityForResult(intent , VOICE_REQUEST_CODE);

And the onActivityResult:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)  {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode == VOICE_REQUEST_CODE && resultCode == RESULT_OK) {
        ArrayList<String> stringArrayListExtra = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
        if(stringArrayListExtra != null && !stringArrayListExtra.isEmpty()) {
            voiceBuilder.append(stringArrayListExtra.toString());
            voiceBuilder.append("\n\n");
        }
    }
}

I've the sample project here https://github.com/libinbensin/GoogleVoiceTest-