【发布时间】:2021-05-15 23:50:36
【问题描述】:
根据this -
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_view_http_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
<intent-filter android:label="@string/filter_view_example_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmos” -->
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
</activity>
关于第一个 Intent 过滤器,我知道当点击链接为“http://www.example.com/gizmos”时,它将重定向到带有该 Intent 过滤器的应用页面。 但是关于第二个意图过滤器“example://gizmos”,这看起来不是一个有效的网址,没有有效的网址会以此开头。那么为什么应用程序使用这种意图过滤器?我见过这么多这样的类型意图过滤器的组合主机和方案不能生成正确的 web url。我知道文档将其称为 URI 而不是 URL。如何打开像“example://gizmos”这样的 URI?可以从外部应用?
【问题讨论】:
标签: android uri android-manifest deep-linking intentfilter