Listening for keywords at all times, like “Ok google” on 4.4 [closed]

北战南征 提交于 2019-11-29 07:53:13

问题


I've checked the new Kitkat libraries to make sure that I'm not missing something. I want my application to always listen to a keyword before performing an action, just like how Google Now always listens for the keywords "Ok google" on the homescreen.

How did Google accomplish this?


回答1:


What you need is called keyword spotting. Apart from online speech API Android has offline recognizer which is a bit more sophisticated. It is not mentioned in official documentation, but you can see the sources here, for example. I'm not sure you will find keyword spotting there, but at least you will have access to low-level recognizer interfaces.

UPD: Keyword spotting and voice activity detection are now implemented in pocketsphinx and pocketsphinx-android. See the official demo to see them both in action.




回答2:


Services can be kept running in the background! They probably invoked it by setting a broadcast receiver to receive the boot completed broadcast and invoking a service which is set to listen for the phrase.



来源:https://stackoverflow.com/questions/20312563/listening-for-keywords-at-all-times-like-ok-google-on-4-4

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