Chapter 6

Open the right screen in your app

For your developer: add the SDK and route people after install.

  1. Understand what it does

    When someone clicks a link and installs your app, the SDK tells your app which link they came from, so it can open that exact screen.

  2. Let your links open the app

    An installed app only opens from a link if the app itself names your domain. We publish the files Apple and Google check on your domain, using the identifiers from chapter 3. Your developer adds the domain to the app as shown here and ships a new build.

    // iOS: Xcode > Signing & Capabilities > Associated Domains
    applinks:link.yourbrand.com
    
    // Android: AndroidManifest.xml, inside your launcher activity
    <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="link.yourbrand.com" />
    </intent-filter>
  3. Add the iOS SDK

    Add the Swift package, then report every launch. Pass the address if a universal link opened the app.

    let link = MMPLink(sdkKey: "sdk_...",
                       baseURL: URL(string: "https://link.yourbrand.com")!)
    let result = try await link.reportOpen(openedURL: universalLinkURL)
    if let destination = result.deepLink {
        // Open destination.path
    }
  4. Enable exact matches on iOS

    Turn on Show continue page on iOS for the link. On first launch, if no destination was returned, show the PasteTokenButton and report its token. iOS shows no permission prompt because the user taps the button.

    button.onToken = { token in
        Task { try await link.reportOpen(pasteToken: token) }
    }
  5. Add the Android SDK

    Include the library and report every launch. Links to https://play.google.com/ are matched automatically through the Google Play install referrer.

    val link = MmpLink(context, "sdk_...", "https://link.yourbrand.com")
    link.reportOpen(openedUrl = intent.dataString) { result ->
        result.getOrNull()?.deepLink?.let { /* open it.path */ }
    }
  6. Read the match type

    install_referrer, universal_link and paste_control are exact. probabilistic is a best guess with a confidence of 0.5, so do not use it to unlock anything valuable. organic means no link was found.