我无法强制自定义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);
答案 0 :(得分:0)
在Google Search应用更新
中看起来已修复