Forcing a particular language for RecognizerIntent is straightforward as described in this answer.
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en-US");
But that only works if the intent instantiated is of type RecognizerIntent.
In my application I use the lower-level SpeechRecognizer, i.e.:
Intent intent = new Intent(SpeechRecognizer.RESULTS_RECOGNITION);
And trying to force the language as decribed above simply doesn’t work.
What is the proper way of programmatically setting the language preference for SpeechRecognizer?
Is this possible at all?
The language preference should work.
Please post more of you code.
You should still create an
Intentlike this:NOT like this:
Then you have to call the
SpeechRecognizerclass directly.Are you doing that?
For reference, see this code‘s
recognizeSpeechDirectly()method.