有没有一种编程方式可以知道 HTTPS URL 是否会使用 Android App Links 打开 Android 应用程序?
对于通用链接(iOS 上的应用程序链接),可以在链接时使用 static let universalLinksOnly: UIApplication.OpenExternalURLOptionsKey
(记录为 here ),以确保URL 是否会打开应用程序。是否有与此等效的 Android 应用程序链接?
最佳答案
<activity
android:name=".ui.activity.TestActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="testapp"
android:host="host1"
android:path="/path1"
android:port="8080" />
</intent-filter>
</activity>
然后:
<a href="testapp://host1:8080/path1?query1=1&query2=true">Open from App</a>
其中scheme和host为必填项,其他要求根据您的实际需要而定。
关于android - 有什么方法可以知道 Android 应用程序链接是否会打开应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57981978/