Blog

    Android Deep Links Beyond Branch.io: Verified App Links, Deferred Links and Safe Patient Screens

    By GauravSeptember 9, 20269 mins read
    On this page

    A Branch.io deeplink in Android, like a link from any link service, rests on two platform features: verified Android App Links, which open a URL straight in the app, and the Play Install Referrer, which carries a link through an install. Those two features decide whether links open reliably, whatever service or in-house code sits on top.

    Startup founders and engineering leaders whose Android app opens patient screens from links in messages, emails or portals will find how verification works, how deferred deep links survive an install and what to check before a link shows any patient data.

    A Branch.io deeplink in Android works like other link services: a verified Android App Link opens the app when it is installed, and otherwise the link's context is recovered after install through the Play Install Referrer or the service's own matching. Agnotic Technologies adds a sign-in and access check before any patient screen.

    Opening patient screens from links?

    We set up verified App Links, deferred links and the checks before any screen opens.

    Android's developer documentation says that when an intent filter sets android:autoVerify to true, Android 6.0 and higher verify each host in the app's intent filters by fetching the Digital Asset Links file at https://hostname/.well-known/assetlinks.json.

    A deep link opens a screen inside an installed app, an App Link is a deep link on your own verified web domain, and a deferred deep link carries its destination through an install. Each behaves differently when the app is missing.

    Link types on Android
    Link typeOpens the app whenIf the app is not installed
    Custom scheme deep linkThe app has registered the schemeThe link fails
    Verified Android App LinkThe domain is verified for the appThe URL opens in the browser
    Deferred deep linkOn first open after installThe user goes to the store, then lands on the screen

    Any app can register the same custom scheme, so a scheme link should never carry anything that matters. A verified App Link is tied to your domain and your app's signing certificate, which is why it is the right base for links that open sensitive screens.

    Verify App Links by publishing a Digital Asset Links file on every domain the app handles, listing the package name and signing certificate fingerprint, and setting autoVerify on the intent filter. Then confirm the result on real devices.

    • Publish assetlinks.json under /.well-known/ on every host in the intent filters, over HTTPS.
    • List the SHA-256 fingerprint of the app signing key; with Play App Signing that is Google's key, not your upload key.
    • Set autoVerify on intent filters with the VIEW action, the BROWSABLE and DEFAULT categories and an https scheme.
    • Check each domain's state with adb shell pm get-app-links, which reports verified or a failure state per domain.

    The same documentation says Android 15 and higher re-verify domains periodically, so a change to assetlinks.json can take up to seven days to reach all devices, while Android 14 and lower usually pick up changes only when the app is installed or updated. On Android 11 and lower, the app becomes the default handler only if every host verifies.

    Deferred deep links survive an install by passing the link's context through the store, so the app can read it on first open and route the user to the screen they were sent to.

    Deferred deep link flow on Android: a link holding only an opaque token is tapped, Google Play carries the install referrer through the install, the app reads it once on first open and sends the user to sign-in, and the server resolves the token and checks access before the patient screen opens
    • Step 1, the user taps a link on a phone without the app, and the web page sends them to Google Play with a referrer parameter.
    • Step 2, the user installs and opens the app.
    • Step 3, on first open the app reads the install referrer once and parses the destination route.
    • Step 4, the app sends the user to sign-in, and opens the destination only if the server confirms access.

    Google's Play Install Referrer documentation says install referrer information is available for 90 days and does not change unless the app is reinstalled, and advises calling the API only once, the first time the app runs after install.

    Link services add their own matching for cases the referrer does not cover, such as installs from other stores, but the checks after the app opens are the same whoever resolves the link.

    Before a link opens a patient screen, the app should confirm who is signed in, that this user may see that patient, and that the link is still valid. The link chooses a destination; it never grants access.

    • Authentication: a signed-out user goes to sign-in first, and the destination is kept only as a route, never as data.
    • Authorisation: the backend checks the signed-in user's access to the record before returning anything.
    • Link validity: links carry an opaque, expiring token the backend resolves, not a raw record id.
    • Fallback: an expired or unauthorised link opens a neutral screen that reveals nothing about the record.

    Patient names, birth dates, record numbers, diagnoses and any other PHI must never go in a deep link URL or its parameters. Links are stored in message histories, browser history, analytics and the logs of every service they pass through.

    • Use an opaque token that maps to the destination on your own server.
    • Expire tokens, and make them single-use where the workflow allows.
    • Keep link parameters out of analytics events, or strip them before sending.
    • Apply the same rule to links handled by a third-party link service, whose logs you do not control.

    Test every link path on real devices, because verification, routing and sign-in fail in ways an emulator with one test account will not show.

    • Domain verification on a clean install for each supported Android version, including Android 11 and lower, where every host must verify.
    • A deferred link through a real store install, not only a build installed from a developer machine.
    • Signed-out, wrong-user and expired-token cases for every patient destination.
    • Links opened from email, SMS and the patient portal, since each app hands links over differently.

    Build in-house when your installs come from Google Play and you need routing, not marketing attribution. Use a link service when you need attribution across channels and stores, and keep the security checks in your own app either way.

    Link service or in-house routing
    QuestionIn-house App Links and referrerThird-party link service
    Installs from stores other than Google PlayLimitedUsually covered by its own matching
    Campaign attribution and reportingBuilt by youIncluded
    Where link data and logs liveYour systems onlyAlso with the vendor
    Sign-in and access checksIn your app and backendStill in your app and backend

    The common mistakes with deep links in Android either break verification without anyone noticing or let the link do more than choose a screen.

    • Listing the upload key fingerprint instead of the app signing key, so verification fails for store builds.
    • Leaving a subdomain out of the files, which on Android 11 and lower stops the app becoming the default handler for any host.
    • Putting record ids or names in link parameters.
    • Opening the destination screen before sign-in completes.
    • Reading the install referrer on every launch instead of once.

    A clinic sends an SMS reminder with a link to the appointment details. The link holds an opaque token, not the appointment id.

    A patient with the app installed taps it; the verified App Link opens the app, which asks for sign-in, resolves the token on the server and shows the appointment. A patient without the app goes to Google Play, installs, and on first open the app reads the referrer once, asks for sign-in and opens the same screen.

    A link forwarded to a family member opens the app at sign-in. The server finds the token belongs to another account, and a neutral screen says the link is not available.

    Deep links touch the website, the backend and the app, so plan them as one feature with one owner rather than a task in the mobile backlog.

    • Decide which screens may be link destinations and which never are.
    • Decide between a link service and in-house referrer handling, based on install sources and attribution needs.
    • Plan the token service on the backend and its expiry rules.
    • Own the domain files and add them to the release checklist.

    Agnotic sets up verified App Links and the domain files, deferred link handling with the Install Referrer or the link service you choose, a token service on the backend, and the sign-in and access checks in front of every patient destination.

    Links that choose a screen, never grant access

    We build App Links, deferred routing and the checks in front of patient data.

    Sources

    Frequently Asked Questions

    No. Verified App Links and the Play Install Referrer cover installed and newly installed users from Google Play. A link service adds attribution and other install sources, and the security checks in the app are needed either way.

    Talk to an engineer about your project

    List the links your app should open and where they are sent from. We will plan verification, deferred routing and the access checks.

    Go deeper

    Services and solutions on this topic