When a user with your app installed clicks an Adjust link, direct deep linking ensures they’re taken directly to specific content within the app.
How it works
- User clicks an Adjust link.
- The OS opens your app and passes the deep link to native code (iOS or Android).
- The
app_linkslibrary forwards the link to your Flutter code. - Your code passes the link to the Adjust SDK for attribution. The SDK also resolves short branded links.
- Your code navigates the user based on the resolved link.
Adjust SDK methods
Process deep link (recommended)
Use the Adjust.processDeeplink method, which does the following:
- Records attribution from deep link clicks
- Resolves short branded links to their long branded link equivalent
- Passes through all other links as is
static Future<String?> processDeeplink(String deeplink)App will open URL (legacy)
The Adjust.appWillOpenUrl method records attribution from deep link clicks but doesn’t resolve short branded links.
static void appWillOpenUrl(String url)The processDeeplink method supersedes this legacy method.
Implementation
Use the app_links library to receive deep links and pass them to the Adjust SDK.
dependencies: app_links: ^6.0.0 # check pub.dev for latest versionfinal _appLinks = AppLinks();
Future<void> _initDeepLinks() async { // Handle link when app is started from a deep link final initialLink = await _appLinks.getInitialLink(); if (initialLink != null) { _handleDeepLink(initialLink); }
// Handle links when app is already running _appLinks.uriLinkStream.listen(_handleDeepLink);}
Future<void> _handleDeepLink(Uri incomingLink) async { // Send deep link to Adjust's servers for attribution. // If short branded link, receive long link. // Otherwise, receive original link. final resolvedLink = await Adjust.processDeeplink(incomingLink.toString());
// Handle failure if resolvedLink is null if (resolvedLink == null) return;
/* * TODO: Handle the deep link and navigate to the appropriate screen. * * Possible resolvedLink formats: * * 1. https://brandname.go.link/?adj_t=def456& * adj_link=https%3A%2F%2Fexample.com%2Fsummer-clothes%3Fpromo%3Dbeach * -> extract and decode the deep link from adj_link * * 2. https://brandname.go.link/summer-clothes?promo=beach&adj_t=def456 * -> extract path from the URL * * 3. example://summer-clothes?promo=beach&adj_t=def456 * -> extract path from the URL * * Note (Android only): If your Android app scheme path differs from iOS, * you may receive: * https://brandname.go.link/?adj_t=def456& * adj_deep_link=example%3A%2F%2Fandroid-specific-path%3Fparam%3Dvalue * -> extract and decode the deep link from adj_deep_link */}Android: Dedicated deep link activity
If your main activity is singleTop, standard, or doesn’t specify a launch mode, you need to create a dedicated deep link activity to ensure deep links open correctly when the app is already running.
This is required because without proper configuration, deep links might launch the app in a new task or within another app’s task (such as a browser), resulting in two instances of the app running simultaneously.
Native Android setup
- Configure the manifest using the Dedicated Deep Link Activity Approach
- Create a DedicatedDeepLinkActivity that forwards deep links to your main FlutterActivity
How the deep link reaches your Flutter code
- User clicks an Adjust link.
- The OS opens your
DedicatedDeepLinkActivitywith the deep link Intent. DedicatedDeepLinkActivityforwards the Intent to your mainFlutterActivityusing flags that bring the existing instance to the front.FlutterActivitypasses the deep link URI to the FlutterEngine.- The FlutterEngine delivers the URI to your Dart code, where
app_linksreceives it.
This flow is the same regardless of which Flutter deep linking library you use. No additional Flutter code is required to integrate with the Adjust SDK beyond what’s shown above.