【问题标题】:Android deep linking issueAndroid 深度链接问题
【发布时间】:2016-07-29 01:05:50
【问题描述】:

当我尝试打开 <a href="tohome://print?https://qcblob.blob.core.windows.net/testing/LabelTesting/label_sample2.png">items</a> 时遇到问题,此链接无法打开应用程序。

我的清单文件:

        <activity
            android:name=".Main2Activity"
            android:exported="true">
            <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:host="print?" android:scheme="tohome"/>
        </intent-filter>
        </activity>

【问题讨论】:

  • ? 是否已经是路径分隔符,这意味着您应该只使用 print 作为主机?
  • 我需要吗?用于拆分目的。你认为这是一个案例吗?
  • 在 URI 模式中,第一个 ?已经用于从参数中拆分主机 - 我自己没有使用过这样的过滤器,但值得一试吗?
  • 马上去检查
  • 发布你的答案,这是一个案例

标签: android deep-linking


【解决方案1】:

如果这是目标链接

tohome://print?https://qcblob.blob.core.windows.net/testing/LabelTesting/label_sample2.png

那么在这种情况下,您的 host 将只是 print

<data android:host="print" android:scheme="tohome"/>

典型的URL 将遵循以下格式

方案:[//[user:password@]host[:port]][/]path[?query][#fragment]

在这种格式中,? 字符将是分隔主机与实际查询字符串的分隔符。

【讨论】: