Android speech recognition API. The system always recognizes the default language

This is what my code looks like.

//loc will be either "ru-RU" or "en-US"
speechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, loc);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, loc); 
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, loc);

The problem is that when I use the program with different phones, it works well. But with my mobile phone, he always chooses the default language. And in rare times, it's just a mix of recognition languages. Like half the result in one language, the other half in another language. I do not know if this is the cause of the system or the code itself? Plus It worked well on my phone. Could this be the cause of some settings? How can I overcome it and fix it? I need to know in order to tell users how to fix this if they have the same problem.

How can I use voice recognition with other android languages

SpeechRecognizer with Google search version 3.6.14.1337016 cannot recognize other voice languages ​​except the default value

+4
source share
2 answers

Firstly, the problem exists when using SpeechRecognizer.
In this case, the only solution was to remove google search, because it is related to the google update . In doing so, we will remove all updates. This worked on my own device.

But, in my opinion, in fact, small updates should not change the behavior of the api . I hope there is a software way to solve this problem or there will be a new update that will fix it.

:

intent.putExtra( "android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", [] {});

artetxem

- . , Google, .

issue

google artetxem issue

+5

@VSL , , Android, .

     Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
     recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "hi");
     recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, InteractionActivity.this.getPackageName());  
     recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
     recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
     speech.startListening(recognizerIntent);
0

All Articles