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

Chrome Custom Tab内跳转无法被Deep Link捕获的原因问询

问题根因及对应解决方案

  • 原因1:Chrome Custom Tab默认拦截所有导航行为,不向系统分发外部跳转请求
    解决方案:初始化CustomTabsIntent时开启外部跳转权限,修改启动代码如下:
    val url = "https://demo.company.com/sso/oidc/start/?idp_connection_id=Username-Password-Authentication&status_response_url=https://member.example.com/urgent"
    val builder = CustomTabsIntent.Builder()
    // 新增这一行,允许Custom Tab将匹配的链接发送到外部应用处理
    builder.setSendToExternalApps(true)
    val customTabsIntent = builder.build()
    customTabsIntent.launchUrl(this, Uri.parse(url))
    
  • 原因2:App Links自动验证失败
    你在intent-filter中配置了android:autoVerify="true",系统会在应用安装时自动校验https://member.example.com/.well-known/assetlinks.json文件是否存在且和你应用的包名、签名信息匹配,验证失败时不会自动将该域名的链接路由到你的应用。
    解决方案:
    1. 确认member.example.com域名下存放了正确的assetlinks.json文件,文件MIME类型为application/json,且访问时不会触发重定向
    2. 若不需要强制App Links验证,可以去掉android:autoVerify="true"属性,用户首次打开对应链接时会弹出应用选择框,用户选择你的应用后后续就会默认跳转
  • 原因3:跳转逻辑属于页面内iframe导航
    如果身份验证后的跳转是在iframe内部触发的,Chrome Custom Tab不会将这类导航分发到外部应用,只有顶层页面的导航才会触发intent解析。
    解决方案:要求前端调整身份验证后的跳转逻辑,使用顶层窗口跳转,而不是iframe内跳转。
  • 原因4:intent-filter匹配规则不足
    你当前的intent-filter仅配置了scheme和host,若跳转链接的host存在拼写误差、或者你使用了多环境域名,会导致匹配失败。如果需要匹配指定路径前缀,可以补充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:host="member.example.com"
             android:scheme="https" 
             android:pathPrefix="/urgent"/>
      </intent-filter>
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.26 22:06:03