Skip to main content

Handle deferred deep links

Deferred deep linking applies when the user does not have your app installed. They open an Adtrace tracker URL with a deep_link, install the app from the store, then open it. Android does not deliver that deep link natively. The Adtrace SDK provides the deep link content after install.

By default, the Adtrace SDK opens deferred deep links automatically. Set a deep link callback on your AdTraceConfig instance if you want to control whether the SDK opens the link.

Note

This page covers the deferred deep link callback on AdTraceConfig. For scheme, manifest, and tracker URL setup, see Set up standard deep linking and the Deep linking overview.

Method signature

public void setOnDeeplinkResponseListener(OnDeeplinkResponseListener listener)
ParameterTypeDescription
listenerOnDeeplinkResponseListenerCalled when the SDK receives a deferred deep link. Return true to let the SDK open it, or false to handle it yourself.

Set this callback before AdTrace.onCreate() to decide what happens when the SDK receives a deferred deep link.

Return valueBehavior
trueLet the Adtrace SDK open the deep link.
falseDo not open it. Handle the URL yourself if needed.

If you do not set this callback, the SDK opens the deep link by default.

Example

Evaluate the deep link in the callback, then return whether the SDK should launch it:

AdTraceConfig config = new AdTraceConfig(this, appToken, environment);
config.setOnDeeplinkResponseListener(new OnDeeplinkResponseListener() {
@Override
public boolean launchReceivedDeeplink(Uri deeplink) {
return shouldAdTraceSdkLaunchTheDeeplink(deeplink);
}
});
AdTrace.onCreate(config);

Replace shouldAdTraceSdkLaunchTheDeeplink(deeplink) with your own logic (for example check the path or query and decide whether the SDK should open the URL).

Example: never open automatically

Return false to prevent the SDK from launching the deep link:

config.setOnDeeplinkResponseListener(new OnDeeplinkResponseListener() {
@Override
public boolean launchReceivedDeeplink(Uri deeplink) {
return false;
}
});