Launch app on voice command (android)

女生的网名这么多〃 提交于 2019-12-18 05:05:05

问题


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.


回答1:


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/




回答2:


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




回答3:


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!



来源:https://stackoverflow.com/questions/15251677/launch-app-on-voice-command-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!