Android: Listen for a voice command (all the time)

2019-04-08 02:44发布

问题:

I have a fairly popular application in Android market, which allows tens of thousands of its users to press a button and give it a voice command. Then I am able to do many different things, like give them current weather forecast, etc...

Anyhow, I came to a point where am getting asked almost every day by users of my app, that they don't want to be pressing a button all the time. They want my app to launch by a trigger word (some specific word command). In that way, app would wake up and ask them for a voice command, all hands free.

I understand that this would require a nonstop listening, it could be a battery eater, etc. But I want to give it a try. Anyhow, and this is why I am here. I simply don't know how to go about it.

I know it's possible, these guys did it and not only that, they listen to a trigger word even when the phone is in the sleeping mode or behind a locked screen: http://www.youtube.com/watch?v=Dd2vo_9euOY

Any ideas on how this could be done? How did the guys above do it? How? Any examples?

Thanks in advance.

回答1:

NoiseAlert is an Application that launches when there is a loud ambient noise, it pays attention to the noise amplitude and also contains wakelocks.

You may use this as an reference. I think you have already implemented the Speeck recognition part.