RE: How to Use Deep Linking in Android?

  • Replies:1
Sudhakar P
  • Forum posts: 1

Oct 6, 2016, 3:00:22 PM via Website

Android deep links open a specific page within an app and optionally pass data to it. Developers may find deep links particularly useful for actions, such as clicking a notification or sending an app link via email.

Let's take an email client as an example. When the user clicks the notification of an email she received, it opens a deep link that takes her to the email in the app. Last but not least, deep links also allow Google to index your app and link to specific sections of your app in searches. The deep link appears as a search result in Google and can take the user to a particular section of your app.

To add a deep link to your app, you must add it to your android manifest file as an intent filter. Take a look at the following example.

<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
android:supportsRtl="true" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar">
    <intent-filter>
        <!-- Notice that the MAIN activity already has an intent-filter. This is not
        A deep link because its action is not a VIEW-->
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity android:name="com.example.matthew.deeplinks.LinkActivity" android:label="@string/title_activity_link"
    android:theme="@style/AppTheme.NoActionBar">
    <intent-filter>
        <!-- Sets the intent action to view the activity -->
        <action android:name="android.intent.action.VIEW" />
        <!-- Allows the link to be opened from a web browser -->
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Allows the deep link to be used without specifying the app name -->
        <category android:name="android.intent.category.DEFAULT" />
        <!-- URI tutsplus://deeplink -->
        <data android:scheme="tutsplus" android:host="deeplink"/>

        <data android:scheme="http" android:host="host"/>
    </intent-filter>
</activity>

The and tags are required. The tag chooses what happens in the app when the link is clicked. The tag specifies what URIs are acceptable as deep links to the page.

Reply
Dev Lt
  • Forum posts: 54

Oct 6, 2016, 9:59:35 PM via Website

Next time please just put the link or mention that it's not your words..
Google: "How to Enable Deep Links On Android tuts+" first article

Reply