问题描述
我的想法是应用程序,但是我还无法弄清楚其中的一部分.在Android版Google即时中,它为您提供了以下搜索选项:
I have a app idea in mind, but I haven't been able to figure out one part yet. In Google Now on Android, it gives you the following options to search:
- 要搜索的类型
- 单击麦克风以说出您的搜索内容
- 或者只需说"Google"即可开始语音搜索.
我想知道他们是如何使#3工作的.我需要有一个关键词,当说出这个关键词时,它会启动语音搜索.
I'd like to know how they made #3 work. I need to have a keyword, that when said, initiates the voice search.
我想他们有某种类型的后台运行服务,不断监听语音操作.有谁知道这是如何实现的?
I imagine they have some type of background running service constantly listening for voice actions. Does anyone know how this is achieved?
以下是Google即时应用的图片:
Here is a image of the Google Now app:
推荐答案
您可以编写服务,然后在该服务中使用 createSpeechRecognizer
.有关完整的服务代码,您可以在
You can write a service and then use createSpeechRecognizer
in that service. For a complete service code for this you can find the answer at Android Speech Recognition as a service on Android 4.1 & 4.2
这篇关于如何使Google即时在Android后台连续运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!