I am Using
speech = SpeechRecognizer.createSpeechRecognizer(getReactApplicationContext().getApplicationContext());
speech.setRecognitionListener(VoiceAppModule.this);
recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 100000000);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.languageacademy");
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 10000);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 10000);
The Above code for Speech recognition.
@Override public void onResults(Bundle results) {
in about On Result the result is giving Bundle[EMPTY_PARCEL] in Result.
ArrayList matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
I tried in many of the Devices it is mainly giving problem in MI phones having android 11 and also some samsung phones.