Launch app on voice command (android)

2019-01-26 20:53发布

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.

3条回答
Melony?
2楼-- · 2019-01-26 21:22

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!

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-26 21:34

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/

查看更多
成全新的幸福
4楼-- · 2019-01-26 21:37

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

查看更多
登录 后发表回答