You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Deep Link配置:指定URL跳转并排除特定路径

Android Deep Link特定URL跳转配置修改方案

当前你的intent filter配置匹配了https://www.example.com/talks/下的所有路径,要实现仅允许指定两个URL跳转、排除view_all.aspx的需求,可按以下方式修改:

方案一:精确匹配固定路径

如果目标URL的路径完全固定(结尾斜杠一致),直接使用android:path指定精确路径:

<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:scheme="https" />
    <data android:host="www.example.com" />
    <data android:path="/talks/item1-chat/" />
    <data android:path="/talks/item2-chat/" />
</intent-filter>

方案二:灵活匹配路径(支持结尾斜杠可选)

如果目标URL可能存在结尾斜杠省略的情况,使用android:pathPattern做模糊匹配:

<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:scheme="https" />
    <data android:host="www.example.com" />
    <data android:pathPattern="/talks/item1-chat.*" />
    <data android:pathPattern="/talks/item2-chat.*" />
</intent-filter>

说明

  • 两种方案都会只匹配符合规则的两个目标URL,https://www.example.com/talks/view_all.aspx因不满足任何路径匹配条件,会被自动排除,不会触发应用跳转。
  • 保留android:autoVerify="true"需确保域名根目录已正确配置assetlinks.json文件,这部分你已实现正常跳转,无需额外调整。

内容的提问来源于stack exchange,提问作者Nensi Kardani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 09:35:07