android中的语音识别无法工作

android中的语音识别无法工作,android,speech-recognition,voice-recognition,speech-to-text,Android,Speech Recognition,Voice Recognition,Speech To Text,我正在尝试创建一个应用程序,在这个应用程序中,当一个电话打到手机上时,电话必须根据用户的语音命令自动接听或挂断。在这里,我给出了我所尝试的,我在startVoiceRecognitionActivity()方法中得到了错误,比如Activity not found exception:找不到处理意图的活动 public void startVoiceRecognitionActivity() { Intent intent = new Intent(RecognizerIntent

我正在尝试创建一个应用程序,在这个应用程序中,当一个电话打到手机上时,电话必须根据用户的语音命令自动接听或挂断。在这里,我给出了我所尝试的,我在startVoiceRecognitionActivity()方法中得到了错误,比如Activity not found exception:找不到处理意图的活动

   public void startVoiceRecognitionActivity()
{
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo...");
    startActivityForResult(intent, REQUEST_CODE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub

    if (requestCode == REQUEST_CODE && resultCode == RESULT_OK)
    {
        String spch = data.getStringExtra(RecognizerIntent.EXTRA_RESULTS);


        if (spch.contains("Yes"))    
         {
            enableSpeakerPhone(this);

            Intent i = new Intent(Intent.ACTION_MEDIA_BUTTON);
            KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_HEADSETHOOK);
            i.putExtra(Intent.EXTRA_KEY_EVENT, event );
            this.sendOrderedBroadcast(i, null);
         }
         else if(spch.contains("No"))
         {
            Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON); 
            buttonUp.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK));
            this.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED");
         }
    }
    super.onActivityResult(requestCode, resultCode, data);
}

有人能帮我找出问题吗…

您是否在清单文件中正确声明了您的活动?

您是否有机会在模拟器上进行测试?