我的问题是标题的确切内容:
主机是Android中深层链接的必需配置吗?
我已经将Google Play深深地联系到了这样一个uri:
“market:// details?id = com.facebook.katana”他们的AndroidManifest:
<data
android:scheme="market"
android:host="details"
android:path=""/>
但现在我需要深入链接到其他没有任何主机配置的应用程序:
这是否可行?
我去了文档(https://developer.android.com/training/app-indexing/deep-linking.html#handling-intents),我发现他们也在使用主机配置:
<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
<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" />
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data android:scheme="http"
android:host="www.example.com"
android:pathPrefix="gizmos" />
</intent-filter>
</activity>
但它也说:
“至少,标签必须包含android:scheme属性。”
所以我想知道深层链接必须使用主机配置吗?
答案 0 :(得分:3)
简短回答:否
任何应用程序仍然可以在不指定主机的情况下提供深层链接支持,尽管更明确指定它。
答案 1 :(得分:2)
主机不是必需参数,但要解析为特定主机网址,您应该提供它。该方案也可以是任何东西,但谷歌推荐使用http方案,这样你的应用和浏览器应用都可以收听深层链接的网址