I need an example of how I could launch my app on a voice command (trigger word). So some sort of a service running in the background listening to everything and if the word matches a set textual value (I guess this can be done through Voice Recognition), app will open. I know this is possible, but I've no clue where to start...
I see other apps are able to establish this. I've close to 1 million users and this is one of the most often requested features.
Google Assistant enables voice-forward control of Android apps. Using Assistant, users can launch apps, perform tasks, access content, and more by using their voice to say things like, "Hey Google, start a run on ExampleApp.".
From the Home screen, tap the Apps icon (in the QuickTap bar) > the App tab (if necessary) > Tools folder > Voice Command .
To do this you have to run Android speech recognition as a service instead of as an activity. Then have your service listen for the key word or phrase.
Check out this git for example code on how to run Android speech recognition as a service:
https://github.com/gast-lib/gast-lib/
Google has just introduced a new voice interaction API from android M. You can checkout the video here, http://www.youtube.com/watch?v=OW1A4XFRuyc&list=PLOU2XLYxmsIJDPXCTt5TLDu67271PruEk
On Android 6 and later, you can just say "Ok Google" or click on the microphone icon, then say "launch YourAppName", and your app will be launched.
If Google voice search cannot recognize your app's name, try to spell it out.
To turn on "Ok Google" voice search: https://support.google.com/websearch/answer/2940021?hl=en
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With