应用索引:Google App搜索无法使用指定的uri

时间:2016-04-22 11:50:20

标签: android-intent uri intentfilter deep-linking google-app-indexing

我想要深层链接的网址采用以下格式: https://abc.example.com

我在特定活动中的意图过滤器如下所示:

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"/>
<data android:host="abc.example.com"/>
<data android:pathPattern="/"/>
</intent-filter>

在进行谷歌浏览器搜索时,我的活动得到了很好的链接。但是,Google应用启动器中的搜索(本地搜索)不起作用。这就是我在onStart和onStop中的活动中编码的内容:

public void onStart() {
    super.onStart();
    client.connect();
    Action viewAction = Action.newAction(
            Action.TYPE_VIEW, 
            "Title", 
            Uri.parse("android-app://my-app-package-name/https/abc.example.com")
    );
    AppIndex.AppIndexApi.start(client, viewAction);
}

为了让Google App搜索有效,是否需要添加/修改意图过滤器或uri中的内容?

1 个答案:

答案 0 :(得分:0)

创建ViewAction时的'title'参数应该简明扼要,关于它所链接的内容也要有好的关键字。

网址应该是网页网址,而不是深层链接。 您可以在here中获得有关API调用的更多信息。

此外,只有在您打开应用内容一段时间后,本地搜索才能完全与自动完成一起使用。