单击 deep-link 直接启动应用程序

Launching the app directly on clicking deep-link

我在我的项目中使用 branch.io 进行深度 linking。单击 deep-link,应用程序不会直接启动,而是显示应用程序列表。然后我需要点击我的应用程序才能打开它。我正在 Oreo(API 级别 27)设备上进行测试。下面是一段清单代码。

         <intent-filter
            android:autoVerify="true"
            tools:targetApi="m">
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="xxx-alternate.app.link"
                android:scheme="https" />
            <data
                android:host="xxx.test-app.link"
                android:scheme="https" />
            <data
                android:host="xxx.app.link"
                android:scheme="https" />
        </intent-filter>

要让深度link直接打开您的应用程序,需要确保以下几点:

  1. 应用 link 的 intent-filter 将 autoverify 选项设置为 true(我看到您的情况已设置)
  2. 您在 Branch 仪表板上上传的 SHA-256 密钥与用于签署 APK 文件的 SHA-256 密钥相同。 (确保您正在针对调试版本进行测试,以使用调试密钥库中的 SHA-256 密钥)

如果设置正确,应用程序 link 应该可以正确打开您的应用程序。此行为自 Android API 23 级及以上更新。

您可以检查 link 域是否正确 link 到您的应用程序 here。输入详细信息并单击 Test Statement 后,如果正确 linked,它应该显示 "Success! Host <your domain> grants app deep linking to <App Package Name>"。

PS:如果您在 Branch 仪表板上更新 SHA-256 密钥,Google 可能需要几个小时才能废弃 Branch 托管的资产-link 文件。