简体   繁体   English

如何将我的应用添加到谷歌本地搜索?

[英]How to add my app into the google local search?

In the android we can see that there is a default "google search" on the launcher. 在Android中,我们可以看到启动器上有默认的“谷歌搜索”。 And I found out that using setting, we can set the searchable items. 我发现使用设置,我们可以设置可搜索的项目。 For example amazon kindle, music, or browser. 例如亚马逊点燃,音乐或浏览器。

The question is, how can I add my app into the searchable items in the google search? 问题是,如何将我的应用程序添加到谷歌搜索中的可搜索项目中? Are there any APIs I can use? 我可以使用任何API吗?

Exactly, the first thing you do is provide a searchable.xml resource to Android. 确切地说,您要做的第一件事是向Android提供searchable.xml资源。 How this is done is described here . 这里描述了如何完成此操作

Next, you have to declare an Activity to be searchable in your Manifest, like so: 接下来,您必须声明一个Activity可以在Manifest中搜索,如下所示:

<activity android:name="...">
  <intent-filter>
    <action android:name="android.intent.action.SEARCH" />
  </intent-filter>
  <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
</activity>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM