2

我无法强制自定义 Android TV 应用程序从语音输入中识别非默认语言。同样的问题出现在内置的 YouTube 应用程序(和其他)中。但是,它可以在内置的 Google 搜索应用程序 (Katniss) 中使用。

我的代码在 Nexus 手机上运行良好,但在 Nexus Player 上设置自定义语言不会以所选语言给出任何结果。

SpeechRecognizer sr =  SpeechRecognizer.createSpeechRecognizer(this);

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"voice.recognition.test");

String loc = "ru-RU";

intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, loc);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, loc);
intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, loc);

intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5);
sr.startListening(intent);
4

1 回答 1

0

Looks like it was fixed in one of Google Search app updates

于 2017-01-31T17:15:53.123 回答