SpeechRecognizer Error 4 ERROR_SERVER - Server sends error status

764 Views Asked by At

What can Google mean - "server error"? That is not a particularly helpful error. Has anyone seen this error before?

I'm posting the code here. The code usually works fine and it is only very few devices this happens on so I imagine it is more to do with the configuration of the device.

        intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,lang);
        intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS,interimResults);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 20000);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 20000);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 10000);
        if (android.os.Build.VERSION.SDK_INT >= 23) {
            intent.putExtra("android.speech.extra.PREFER_OFFLINE", true);
        }
        intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,maxResults);

        Handler loopHandler = new Handler(Looper.getMainLooper());
        loopHandler.post(new Runnable() {

            @Override
            public void run() {
                recognizer.startListening(intent);
            }

        });
0

There are 0 best solutions below