创建 android studio 的深层链接,我将 assetlinks.json 文件上传到主机上我的 .well-known 文件夹中。
在 android studio 深度链接构建工具上一切正常,但是当我点击我网站上的链接时,它不会打开应用程序。 我的深层链接配置是这样的:
<activity
android:name=".activities.OrdersActivity"
android:screenOrientation="portrait">
<tools:validation testUrl="https://myhost.com/cart/success" />
<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"
android:host="myhost.com"
android:pathPrefix="/cart/success" />
</intent-filter>
</activity>
我试过的网址是这个
https://myhost.com/cart/success?Authority=000000000000000000000000000000074139&Status=OK
请您参考如下方法:
您的代码看起来不错。您在哪个应用程序中点击了链接?他们可能会阻止深层链接并在他们的应用程序中使用 custom tabs library 打开它们?
您可以通过执行下面的 adb shell 命令来尝试您的深层链接:
am start -a android.intent.action.VIEW -d "https://myhost.com/cart/success?Authority=000000000000000000000000000000074139&Status=OK"
您无需将 assetlinks.json 文件上传到您的 .wellknown 文件夹即可实现深层链接。它是应用程序链接所必需的。应用链接和深度链接之间的区别在于,深度链接需要用户批准才能启动您的应用,而应用链接会自动启动。
更详细的解释见下面的文章
