小编Spo*_*nic的帖子

Android App Intent Filter 有时不起作用

对于一个项目,我遇到了一个很奇怪的问题:

深度链接在去年一直运行良好,但最近(自 2019 年 1 月开始)我们收到用户抱怨深度链接已停止工作(有人说 10 次中有 9 次)。

我们没有更改任何此代码,并且很难重现此问题。

更奇怪的是,在我们自己遇到问题的少数情况下,Android 操作系统甚至没有通过“打开方式”对话框将我们的应用程序显示为选项。这表明操作系统有时会忘记应用程序在其清单中注册了意图过滤器。

重新启动应用程序似乎可以解决此问题,并且深层链接再次开始工作。每次我们从 Android Studio 进行新构建时,该应用程序似乎也能正常工作,这使得复制变得非常困难。

我们的清单有一个处理深层链接的特定活动:

<activity
    android:name="com.company.DeepLinkActivity"
    android:noHistory="true"
    android:launchMode="singleTask">
    <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:host="ideal-payment"
            android:scheme="com.company.ideal" />
        <data
            android:host="ideal-payment"
            android:scheme="com-company-ideal" />

    </intent-filter>

    <intent-filter android:autoVerify="true">
        <action   android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="${appLinkIdealHost}"
            android:pathPrefix="/ideal-betaling/landingpage"
            android:scheme="https" />
    </intent-filter>

    <intent-filter android:autoVerify="true">
        ...
    </intent-filter>

    <intent-filter android:autoVerify="true">
        ...
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

我们认为这可能与 autoVerify 无法访问有关,但是操作系统应该显示“打开方式”-对话框,当问题出现时不会发生这种情况。

有没有人遇到过类似的问题?任何帮助或建议将不胜感激。

android intentfilter deeplink

6
推荐指数
1
解决办法
1542
查看次数

标签 统计

android ×1

deeplink ×1

intentfilter ×1