Skip to content

Android deeplinking guide

Verify that the Asset Links file contents are correct. This should be at https://mi.example.com/.well-known/assetlinks.json. Make sure to replace the domain with your company's MovableInk subdomain. It should look similar to the example below. If it doesn't, check with your team to ensure Deeplinking support has been enabled for your company. If you haven't already, you'll need to provide MovableInk your application's Package Name.

[
  {
    "target": {
      "namespace": "android_app",
      "package_name": "com.example.app",
      "sha256_cert_fingerprints": [
        "AA:0C...." 
      ]
    },
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ]
  }
]

Configure AndroidManifest.xml

Add the internet permission to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

Depending on your requirements, you can implement one or more of the following deep link types:

Custom URI Schemes

Custom URI schemes (e.g., myapp://details/123) allow your app to handle custom links:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />

  <data android:scheme="myapp" />
</intent-filter>

Web links enable your app to handle regular HTTP/HTTPS URLs:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data android:scheme="http" />
    <data android:scheme="https" />
    <data android:host="mydomain.com" />
</intent-filter>

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data android:scheme="http" />
    <data android:scheme="https" />

    <data android:host="mydomain.com" />
</intent-filter>

If using android App links available on Android 6.0 and higher , you can use the App Links Assistant in Android Studio (Tools -> App Links Assistant) to create and modify app-links

Add URL Mapping example

Here is an example of the relevant paths which should be added to the URL Mapping editor:

URL Mapping example

This will have set up the intent-filter within the Manifest file, as follows:

....
  <activity
      android:name=".MainActivity"
      android:exported="true"
      android:launchMode="singleInstancePerTask"
      android:theme="@style/Theme.ShoppingCart">
      <intent-filter android:autoVerify="true">
          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />

          <data
              android:scheme="https"
              android:host="mi.example.com"
              android:pathPrefix="/p/cpm" />
      </intent-filter>
      <intent-filter>
          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />

          <data
              android:scheme="https"
              android:host="mi.example.com"
              android:pathPrefix="/p/rpm" />
      </intent-filter>
      <intent-filter>
          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />

          <data
              android:scheme="https"
              android:host="mi.example.com"
              android:pathPrefix="/p/gom" />
      </intent-filter>
  </activity>

Official documentation shows an overview of how to test the app links within Android Studio.