android - Start RecognitionListener following vocal command -


i'm trying build app sparks action following pre-defined voice command me, "ok google". want device launch voice recognition intent give "ok google" type of message. know how launch such intent:

if (isconnected()) {             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, 4);             intent.putextra(recognizerintent.extra_language, "en-us");             startactivityforresult(intent, request_code);         } else {             toast.maketext(getapplicationcontext(), "plese connect internet", toast.length_long).show();         } 

however, right now, i'm able start intent following tap on button. want able launch without interacting ui. may possible launch intent after intent in expectation of vocal command, it's not desired approach.

does know how this?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -