How do Android App Links work, and why might links still open in the browser?
AndroidMid-level
In shortThe app declares https intent filters with autoVerify, and the website serves /.well-known/assetlinks.json with the package name and signing certificate fingerprints. Android verifies them at install; since Android 12, unverified web links open in the browser. The most common failure is the wrong fingerprint under Play App Signing.
Model answer
Setup:
- Manifest: an intent filter with
VIEW,DEFAULT,BROWSABLE,scheme="https", the host and paths, andandroid:autoVerify="true". - Website:
https://<host>/.well-known/assetlinks.json, served over HTTPS without redirects, withdelegate_permission/common.handle_all_urls, the package name and the SHA-256 fingerprints of the signing certificate.
Behavior: Android verifies each host when the app is installed or updated. Verified links open the app directly with no chooser; since Android 12, unverified web links open in the browser by default (users can enable them per app in settings). Custom schemes have no verification or web fallback.
Why links open the browser:
- Wrong fingerprint: with Play App Signing, users’ installs are signed with the app signing key from Play Console, not the upload key. Debug builds have yet another fingerprint.
- File problems: redirects, wrong content type, unreachable host, a typo in the package name.
- Missing hosts: every host (including
www) needs its own file.
Debugging: adb shell pm get-app-links <package> shows per-domain state; adb shell pm verify-app-links --re-verify <package> retries; adb shell am start -a android.intent.action.VIEW -d <url> tests a link.
In the app: route links through Navigation (navDeepLink), validate ids and paths, keep a pending route for screens behind login, and never perform state changes directly from a link.
What they're looking for
The two-sided verification, Android 12 behavior, the Play App Signing fingerprint gotcha, debugging commands, routing into navigation, and treating links as untrusted input.
Common mistakes
- Using the upload key fingerprint.
- Serving assetlinks.json through a redirect.
- Performing actions directly from link parameters.
More android questions
- How do you make sure background work in a mobile app stops when the user leaves the screen?Mid-level
- What's the difference between a configuration change and process death on Android, and what survives each?Mid-level
- How would you modularize a large Android app, and how do you keep builds fast?Senior
- How do you store an auth token securely on Android?Mid-level