Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android Speech recognition API.System always recognizes default language

Here is how my code looks.

//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);

Problem is that, when I am using the program with different phones it works well.But with my cell phone it always chooses default language. And rare times it is just mixing recognition languages. Like half of the result is in one language other half in another language. I dont know whether it is cause of system or from code itself? Plus It worked well before on my phone too. Can it be cause of some settings? How can I overcome and fix it? I need to know to inform users how to fix it if they will have the same problem

How can I use voice recognition with other languages android

SpeechRecognizer with Google Search version 3.6.14.1337016 can't recognize other voice language except default

like image 941
vsl Avatar asked Aug 26 '14 10:08

vsl


1 Answers

Firstly, the problem exists while using SpeechRecognizer
On this case only solution was to delete google search cause it is related to google search update. Doing so we will delete all updates. This worked on my own device

But on my opinion,actually, small updates should not change api behaviour. I hope there is programmatic way to solve this issue or there will be new update that will fix it

Here is undocumented programmatic solve:

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

it is artetxem's answer

Other solution is just to call activity for recognition. This way google's dialog activity will be seen but there will be no language problems.

Issue opened by me issue

Issue opened on google search by artetxem issue

like image 129
vsl Avatar answered Oct 18 '22 04:10

vsl