2

如果我在语音输入设置中选择“增强型 Google 服务”,我的应用程序中的语音输入将不起作用(请参见屏幕截图):

在此处输入图像描述

我使用没有对话的语音识别:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MyRecognitionListener listener = new MyRecognitionListener();
    sr = SpeechRecognizer.createSpeechRecognizer(this);       
    sr.setRecognitionListener(listener);

    findViewById(R.id.bt1).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);    
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
            intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
            intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"voice.recognition.query");           
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en_US");
            intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, "en_US");
            sr.startListening(intent);
       }
   });     
}

你能帮忙吗,可能是什么问题?

4

0 回答 0