【问题标题】:Is host a required configuration for deep linking in Android?在 Android 中,主机是深度链接的必需配置吗?
【发布时间】:2014-09-23 15:06:04
【问题描述】:

我的问题是标题的确切含义:

主机是 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 属性。”

所以我想知道主机配置对于深度链接是强制性的吗?

【问题讨论】:

    标签: android android-intent intentfilter deep-linking


    【解决方案1】:

    简短回答:否

    任何应用程序仍然可以在不指定主机的情况下提供深度链接支持,尽管指定主机更加明确。

    【讨论】:

    • 我的 android 和 iOS 开发人员没有使用方案来配置深度链接,所以如果我使用 PHP SDK 发送,他们的应用程序可以处理推送请求吗?请看:stackoverflow.com/questions/47172541/…
    • 太棒了!!,就我而言,我有这样的网址:schema://hostname?idp=0001 如何处理这个网址?
    【解决方案2】:

    Host 不是强制参数,但要解析到特定的主机 url,您应该提供它。该方案也可以是任何东西,但 google 推荐使用 http 方案,以便您的应用和浏览器应用都可以侦听深层链接的 url

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多