You need to run GoogleVoice in the background when starting the application. How can this be implemented?

  • and what do you want to do? If the application does not know how to work in the background, then without hacks you will not force it to work there. - KoVadim
  • so that when onStart() application is launched and simultaneously in the background GoogleVoice. You can contact via Intent , but then the focus will go from the application to GoogleVoice. and you just need to start and hang in the memory. - tim_taller
  • it is clear that through the Service , but how to organize the launch of the application? - tim_taller
  • But what's the point that it will hang in the background? load speed optimization? - KoVadim
  • it is she. - tim_taller

1 answer 1

Simplified as follows:

 RecognitionListener recognitionListener = new CustomRecognitionListener(); SpeechRecognizer speechRecognizer = SpeechRecognizer.createSpeechRecognizer(context); speechRecognizer.setRecognitionListener(recognitionListener); Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); // TODO: ... 

Where

 class CustomRecognitionListener implements RecognitionListener { // TODO: ... } 

More details, for example, here: VoiceInput.java .