如何以编程方式启动谷歌现在语音搜索? [英] How to programmatically initiate a Google Now voice search?
本文介绍了如何以编程方式启动谷歌现在语音搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要开始一个谷歌现在语音搜索当用户presses一个按钮。但是,我找不到意图开始在文档的搜索。
I want to start a Google Now voice search when the user presses a button. However, I can't find the Intent to start the search in the docs.
有谁知道如何启动活动的谷歌现在语音搜索
Does anybody know how to start activity for Google Now voice Search?
推荐答案
使用<一个href="https://developer.android.com/reference/android/speech/RecognizerIntent.html#ACTION_RECOGNIZE_SPEECH"相对=nofollow> ACTION_RECOGNIZE_SPEECH
:
private static final int RECOGNIZER_REQ_CODE = 1234;
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
startActivityForResult(intent, RECOGNIZER_REQ_CODE);
请注意,您必须使用 startActivityForResult()
为 startActivity()
不支持。见上面的链接的文档的详细信息。
Please note that you have to use startActivityForResult()
as startActivity()
is not supported. See the above linked docs for details.
这篇关于如何以编程方式启动谷歌现在语音搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文