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

Kotlin邮件确认Deep Link跳转浏览器而非指定App问题排查

Kotlin Deep Link邮件确认无法唤起App的解决方案

是否需要部署对应网站?

需要。Android的autoVerify机制要求你必须在目标域名下放置验证文件,以此证明你拥有该域名的所有权,否则系统不会将该域名的链接直接关联到你的App。

具体解决方案

  • 检查Manifest配置正确性
    确保LoginActivity的intent-filter配置完整且正确,示例如下:

    <activity
        android:name=".LoginActivity"
        android:exported="true">
        <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" />
            <!-- 配置http和https协议 -->
            <data
                android:scheme="http"
                android:host="www.exampleee.com" />
            <data
                android:scheme="https"
                android:host="www.exampleee.com" />
        </intent-filter>
    </activity>
    

    注意:android:exported="true"必须添加,否则Android 12+的App无法接收外部Intent。

  • 配置域名验证文件
    在你的域名根目录下创建.well-known/assetlinks.json文件,文件内容格式如下:

    [
      {
        "relation": ["delegate_permission/common.handle_all_urls"],
        "target": {
          "namespace": "android_app",
          "package_name": "com.your.package.name",
          "sha256_cert_fingerprints": ["你的App签名SHA256指纹"]
        }
      }
    ]
    

    获取SHA256指纹的方法:在Android Studio终端执行./gradlew signingReport,找到对应build类型(如release、debug)的SHA-256值。
    确保该文件可以通过https://www.exampleee.com/.well-known/assetlinks.json正常访问,无404或权限问题。

  • 测试Deep Link有效性
    使用adb命令直接测试,避免邮件客户端的干扰:

    adb shell am start -W -a android.intent.action.VIEW -d "https://www.exampleee.com/?token=1239&tokenId=1234" com.your.package.name
    

    如果能正常唤起LoginActivity,说明配置本身没问题,问题可能出在邮件客户端或系统验证环节。

  • 额外排查点

    • 确认测试设备运行Android 6.0(API 23)及以上版本,autoVerify仅在该版本后生效。
    • 检查是否有其他App注册了相同域名的Deep Link,导致系统无法确定默认打开应用。
    • 部分邮件客户端可能会强制在浏览器中打开链接,可尝试用系统自带邮件App测试,或引导用户手动选择打开应用。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 23:24:40