应用内索引无工作于Android 4



我已经遵循了文档,以

  • assetlinks.json上传到https://mycompany.com/.well-known/assetlinks.json
  • com.google.firebase:firebase-appindexing:11.6.0添加为依赖项和

  • 添加到我的应用的清单中:

    <activity
        android:name=".main.view.MainScreenActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/AppTheme.NoActionBar">
        <!--deeplinking-->
        <intent-filter
            android:autoVerify="true"
            android:label="@string/app_name">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:host="www.mycompany.com"
                android:path="/" />
            <data android:scheme="http" />
            <data android:scheme="https" />
            <data android:pathPattern="/somepath/" />
        </intent-filter>
    </activity>
    

我已经根据文档对所有这些进行了测试,一切似乎都很好。

在Android 5及更高版本上,我可以从Play商店下载我的应用程序,搜索网站的内容,Google将直接从我的应用中显示结果。我还可以直接从Google的搜索结果跳入我的应用程序。一切都很好。

这在Android 4上行不通。

我注意到,在Android 5上安装和打开我的应用程序时,以下将显示在日志中:

i/intentFilterIntentsvc:验证 意图式滤波器。验证ID:4方案:" https"主机:" www.mycompany.com" 软件包:" com.mycompany.myapp"。12-11 14:26:49.641 1708-9067/?

i/intentFilterIntentsVC:验证4完成。成功:是的。失败的 主持人:。

这不会在Android 4设备上发生。

知道这里有什么问题?我没有找到任何信息,说在Android 4上不支持应用程序内索引。

没有最低限度的API级别可以使用应用程序索引API本身,但不幸的是,对于jelly bean以下的用户,API依赖于Google搜索版本的最低限度为API 17.这是Ianhanniballake的答案的简单重新发布。这是OG答案的链接。

最新更新