2

The voice input in my application does not work if I select "Enhanced Google services" in Voice input Settings (please see screenshot):

enter image description here

I use speech recognition without a dialog:

@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);
       }
   });     
}

Could you please help, what can be the problem?

ViH
  • 419
  • 2
  • 14

0 Answers0