如何为 Android 应用程序创建 Deep Link

How to create Deep Link for an Android Application

我已经在 Google Play Store 上创建并部署了一个应用程序,我需要为该应用程序创建一个 Deep Link。我已经搜索过,但无法找到为我的应用程序创建 Deep Link 的任何方法。

请指导我如何为这个应用程序创建一个 Deep Link。

谢谢

如 Android 文档所述:

To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest. These intent filters allow deep linking to the content in any of your activities. For example, the user might click on a deep link to view a page within a shopping app that describes a product offering that the user is searching for.

为此,您需要在清单中添加具有 actiondatacategory 属性的意图过滤器:

<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 "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-->
    <!-- Accepts URIs that begin with "example://gizmos” -->
    <data android:scheme="example"
          android:host="gizmos" />

</intent-filter>

您可以在 developers.android

中阅读有关深度链接的更多信息