Reputation: 2450
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?
Upvotes: 0
Views: 1272
Reputation: 12159
The language preference should work.
Please post more of you code.
You should still create an Intent
like this:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
NOT like this:
Intent intent = new Intent(SpeechRecognizer.RESULTS_RECOGNITION);
Then you have to call the SpeechRecognizer
class directly.
Are you doing that?
For reference, see this code's recognizeSpeechDirectly()
method.
Upvotes: 1