How to create Deep Link for an Android Application

时光总嘲笑我的痴心妄想 提交于 2021-01-29 03:12:39

问题


I have created and deployed an Application on Google Play Store, I need to create a Deep Link for that app. I have searched, but unable to find out any way to create Deep Link for my application.

Kindly guide me how can i create a Deep Link for this application.

Thanks


回答1:


As Android documentation says:

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.

To do this you need to add an intent filter in your Manifest with action, data and category attributes:

<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>

You can read more about deep linking in developers.android



来源:https://stackoverflow.com/questions/41057911/how-to-create-deep-link-for-an-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!