android - 有什么方法可以知道 Android 应用程序链接是否会打开应用程序?

标签 android ios hyperlink linker universal

有没有一种编程方式可以知道 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/

相关文章:

java - android从数据库byte[]异步加载图像

c++ - 静态变量无法解析

c# - Linq To Entities 在 where 子句中进行错误的 SQL 转换

IOS MusicSequence & MusicPlayer 外部 midi 时钟同步

javascript - 来自文本输入的动态链接

java - 图层列表上的右下角为黑色

android - 连接到WLAN网络时Android崩溃

android - 如何避免音频重叠

ios - 我的应用程序正在请求 “Have offline access” 的权限,为什么?

ios - 如何避免 iOS 11 上的 GPS 跟踪出现间隙