接收来自Google即时的搜索 [英] Receive search from Google Now
本文介绍了接收来自Google即时的搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我尝试实施此方法-语音搜索和您的应用之间最快的路线
So I tried to implement this - The fastest route between voice search and your app
到目前为止,我有...
What i have so far is...
清单中
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
在MainActivity中:
In MainActivity:
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
editText.setText(query);
}
如果我在Google即时中输入应用名称,则会显示该应用.如果我打开它,则什么也没有发生,因此我没有收到搜索词(应用程序名称).
If I type my app name in Google Now, the app is shown. If I open it nothing happens, so I didn't receive the search term (the app name).
如何像帖子中描述好吧Google,在MyApp上搜索披萨"那样实现?
How do I implement like how the post has described "Ok Google, search pizza on MyApp"?
推荐答案
查看全文