Skip to content

Enabling Deeplinks

Add required permissions to AndroidManifest.xml

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

Add Intent Filters in the AndroidManifest.xml

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

Instantiating the SDK

Within the Application() class, the MIClient.start() method will have to be invoked:

class App : Application() {
    override fun onCreate() {
        super.onCreate()
        MIClient.start()
    }
}