Skip to main content

Android App Links and Dynamic Deep Links

Use this guide when your Android integration needs verified app links, deferred deep-link payload retrieval, or DriveMetaData-generated dynamic deep links.

Android App Links require a relationship between your app package and the web domain used in DriveMetaData links.

1. Create assetlinks.json

Create a file named assetlinks.json:

[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "your.package.name",
"sha256_cert_fingerprints": ["YOUR_SHA256_CERT_FINGERPRINT"]
}
}
]

Replace your.package.name with the Android package name and YOUR_SHA256_CERT_FINGERPRINT with the SHA-256 fingerprint for the signing key used by the build that will open links.

2. Get the SHA-256 Fingerprint

Use keytool against the signing keystore:

keytool -list -v -keystore your_keystore_file.jks -alias your_key_alias -storetype JKS

Use the SHA256 value from the output.

3. Host or Share the File

The file must be available at:

https://<company>.dmd.mobi/.well-known/assetlinks.json

If DriveMetaData hosts this domain for the integration, share the final assetlinks.json file with the DriveMetaData team.

4. Add the Launcher Activity Filter

Add the verified link filter to the activity that should receive the link:

<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="<company>.dmd.mobi" />
</intent-filter>

Use the incoming Uri when it is available:

Uri uri = getIntent().getData();

if (uri != null) {
DriveMetaData.getBackgroundData(this, uri, new DeepLinkCallBack() {
@Override
public void onResponse(String response) {
Log.d("DMD DeepLink", response);
}

@Override
public void onError(Exception exception) {
Log.d("DMD DeepLink", exception.toString());
}
});
}

Some SDK flows can retrieve background data after handleDeepLink has already processed the link:

DriveMetaData.getBackgroundData(this, new DriveMetaData.DeepLinkCallBack() {
@Override
public void onResponse(String response) {
Log.d("DMD DeepLink", response);
}

@Override
public void onError(Exception exception) {
exception.printStackTrace();
}
});

Responses are JSON strings. Parse and validate the payload before routing users or applying campaign parameters.

Dynamic deep links are created with a short-lived API token. Treat these API credentials as server-side credentials. Do not call these APIs directly from mobile apps.

1. Get an Auth Token

curl --location 'https://api.drivemetadata.com/api/dmd/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "dmd_login_id",
"password": "dmd_password"
}'

The token is valid for a limited time. Store it only in a backend service or secure operational environment.

curl --location 'https://p-api.drivemetadata.com/create-deeplink/' \
--header 'accept: application/json' \
--header 'client-id: 1635' \
--header 'workspace-id: 1637' \
--header 'token: Bearer <auth_token>' \
--header 'Content-Type: application/json' \
--data '{
"sub_domain": "example",
"pub_identifier": "dmd_deeplink",
"pub_id": 14,
"app_bundle_id": "com.example.app",
"android_id": 3743,
"ios": "",
"ios_id": 0,
"web": "",
"web_id": 0,
"sub_id1": "",
"sub_id2": "",
"sub_id3": "",
"sub_id4": "",
"sub_id5": "",
"sub_pub": "",
"cost_currency": "USD",
"cost_value": "0",
"cost_model": "cpc",
"deep_link_sub1": "",
"deep_link_sub2": "",
"deep_link_sub3": "",
"deep_link_sub4": "",
"deep_link_sub5": "",
"deep_link_sub6": "",
"deep_link_sub7": "",
"deep_link_sub8": "",
"deep_link_sub9": "",
"deep_link_sub10": "",
"deep_link_value": "app://example/path"
}'

Successful responses include a deeplinkTracker value:

{
"code": 200,
"success": true,
"message": "Deeplink tracker data saved successfully",
"data": {
"deeplinkTracker": "xpi8s"
}
}

Checklist

  • Generate assetlinks.json for the release signing key.
  • Confirm the file is available under /.well-known/assetlinks.json.
  • Add the app link host to the launcher or target activity.
  • Test fresh install, installed app, and background app link flows.
  • Create dynamic deep links only from trusted backend or operations systems.