- Android App Linking
- Web url
- Android
- Features
- Pros and Cons
- App Links
- Android
- Features
- Pros and Cons
- Custom scheme
- Android
- Features
- Pros and Cons
- Intent scheme
- Android
- Features
- Pros and Cons
- App scheme
- Android
- Features
- Pros and Cons
- Firebase Dynamic Links
- Android
- Features
- Pros and Cons
- Play Store url
- Android
- Features
- Pros and Cons
- Market scheme
- Android
- Features
- Pros and Cons
- Referrer Receiver
- Deeplinking
- Deferred deeplink
- Url redirections
- Adb Activity Manager
Android App Linking
The ultimate developer guide to Android application linking methods
The main objectives of this guide are to explore the most common deeplinking methods available on Android and evaluate their pros and cons.
The source code of the AppLinks Android app is available on the corresponding GitHub repository.
Method | Link | App not installed | Offline | Referrer | Deeplink | Deferred deeplink |
---|---|---|---|---|---|---|
Web url | Test | ❌ | ✔️ | ❌ | ✔️ | ❌ |
App Links | Test | ❌ | ✔️ | ❌ | ✔️ | ❌ |
Custom scheme | Test | ❌ | ✔️ | ❌ | ✔️ | ❌ |
Intent scheme | Test | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
App scheme | Test | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
Firebase Dynamic Links | Test | ✔️ | ❌ | ❌ | ✔️ | ✔️ |
Play Store url | Test | ✔️ | ✔️ | ✔️ | ❌ | ✔️ |
Market scheme | Test | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Web url
http://smarquis.fr/action?key=value#data
Android
Uri | Value |
---|---|
scheme | http |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ❌ |
Offline | ✔️ |
Referrer | ❌ |
Deeplink | ✔️ |
Deferred deeplink | ❌ |
Pros and Cons
- Initial disambiguation dialog
- Doesn’t work on the same domain
- Some (in-app) browsers might directly handle these links and prevent the app to launch
App Links
https://smarquis.fr/action?key=value#data
A JSON verification file needs to be available at https://smarquis.fr/.well-known/assetlinks.json containing the application’s package name and keystore fingerprint
To test an existing statement file, you can use the official Statement List Generator and Tester tool.
During app install/update, an Android service will verify if the App Links configuration complies with the server side assetlinks.json file.
The results will be sent to logcat, with these tags: IntentFilterIntentSvc and SingleHostAsyncVerifier
Click to see logcat content
Valid App Links configuration
Invalid App Links configuration (missing or malformed assetlinks.json file, missing package_name or sha256_cert_fingerprints )
Android
Same as Web url but with https only and android:autoVerify=»true» attribute.
Uri | Value |
---|---|
scheme | https |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ❌ |
Offline | ✔️ |
Referrer | ❌ |
Deeplink | ✔️ |
Deferred deeplink | ❌ |
Pros and Cons
- No more disambiguation dialog
- No potential app hijacking
- Doesn’t work on the same domain
- Some (in-app) browsers might directly handle these links and prevent the app to launch
Custom scheme
link://smarquis.fr/action?key=value#data
Android
Uri | Value |
---|---|
scheme | link |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ❌ |
Offline | ✔️ |
Referrer | ❌ |
Deeplink | ✔️ |
Deferred deeplink | ❌ |
Pros and Cons
- Some browser doesn’t handle non-http links
Intent scheme
intent://smarquis.fr/action?key=value#data#Intent;scheme=link;package=fr.smarquis.applinks;S.key=value;S.market_referrer=my%20referrer%20data;end
Extra parameters can be added to the link and will be transfered as extras Bundle in the Intent :
- String: S.key=value
- Boolean: B.key=value
- Integer: i.key=value
- Long: l.key=value
- Float: f.key=value
- S.browser_fallback_url is the fallback URL if the corresponding link doesn’t work of if app isn’t available (will be removed from the Intent ).
- S.market_referrer will trigger a com.android.vending.INSTALL_REFERRER Broadcast once the app is installed.
Android
The url will be rewritten by the parseUri() method from the Android source code.
The new url will be link://smarquis.fr/action?key=value#data
And will contain additional parameters in the Intent .
Uri | Value |
---|---|
scheme | link |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Extra | Value |
---|---|
key | value |
market_referrer | my referrer data |
Referrer |
---|
my referrer data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ✔️ |
Offline | ✔️ |
Referrer | ✔️ |
Deeplink | ✔️ |
Deferred deeplink | ❌ |
Pros and Cons
- Some browser doesn’t handle non-http links
App scheme
android-app://fr.smarquis.applinks/https/smarquis.fr/action?key=value#data#Intent;S.key=value;S.market_referrer=my%20referrer%20data;end
Extra parameters can be added to the link and will be transfered as extras Bundle in the Intent :
- String: S.key=value
- Boolean: B.key=value
- Integer: i.key=value
- Long: l.key=value
- Float: f.key=value
- S.market_referrer will trigger a com.android.vending.INSTALL_REFERRER Broadcast once the app is installed.
Android
The url will be rewritten by the parseUri() method from the Android source code.
The new url will be https://smarquis.fr/action?key=value#data
And will contain additional parameters in the Intent .
Uri | Value |
---|---|
scheme | https |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Extra | Value |
---|---|
key | value |
market_referrer | my referrer data |
Referrer |
---|
my referrer data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ✔️ |
Offline | ✔️ |
Referrer | ✔️ |
Deeplink | ✔️ |
Deferred deeplink | ❌ |
Pros and Cons
- Some browser doesn’t handle non-http links
Firebase Dynamic Links
https://mr7f2.app.goo.gl/Tbeh
Create the link from the Firebase console.
Android
Same requirements as App Links.
And add the Firebase Dynamic Links dependency in the app-level build.gradle file:
Then in your Activity ‘s onCreate method, use this code to get the link if the user came from a Firebase Dynamic Link:
Uri | Value |
---|---|
scheme | https |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ✔️ |
Offline | ❌ |
Referrer | ❌ |
Deeplink | ✔️ |
Deferred deeplink | ✔️ |
Pros and Cons
- Ugly progress dialog when fetching link data
Play Store url
https://play.google.com/store/apps/details?id=fr.smarquis.applinks&url=link%3A%2F%2Fsmarquis.fr%2Faction%3Fkey%3Dvalue%23data&referrer=my%20referrer%20data
Very similar to the Market scheme.
This url contains additional query parameters that will be handled by the Play Store app:
- url is the forwarded url
- referrer will trigger a com.android.vending.INSTALL_REFERRER Broadcast once the app is installed.
Android
The url will be rewritten by the Play Store to link://smarquis.fr/action?key=value#data
Uri available in deferred deeplink only
Uri | Value |
---|---|
scheme | link |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Referrer |
---|
my referrer data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ✔️ |
Offline | ✔️ |
Referrer | ✔️ |
Deeplink | ❌ |
Deferred deeplink | ✔️ |
Pros and Cons
- Some (in-app) browsers might directly handle these links and prevent the Play Store app to launch
- When app is installed, it still opens the Play Store app and completely ignores the deeplink
- Changes the «Open» button in Play Store to «Continue»
- Triggers a notification with «Tap to continue»
Market scheme
market://details?id=fr.smarquis.applinks&url=link%3A%2F%2Fsmarquis.fr%2Faction%3Fkey%3Dvalue%23data&referrer=my%20referrer%20data
This url contains additional query parameters that will be handled by the Play Store app:
- url is the forwarded url
- referrer will trigger a com.android.vending.INSTALL_REFERRER Broadcast once the app is installed.
Android
The url will be rewritten by the Play Store to link://smarquis.fr/action?key=value#data
Uri | Value |
---|---|
scheme | link |
host | smarquis.fr |
path | /action |
query | ?key=value |
fragment | data |
Referrer |
---|
my referrer data |
Features
Feature | ✔️ / ❌ |
---|---|
App not installed | ✔️ |
Offline | ✔️ |
Referrer | ✔️ |
Deeplink | ✔️ |
Deferred deeplink | ✔️ |
Pros and Cons
- Changes the «Open» button in Play Store to «Continue»
- Triggers a notification with «Tap to continue»
Referrer Receiver
Add the Broadcast Receiver in AndroidManifest.xml
And in the Receiver’s onReceive() method, you can get the referrer value
Deeplinking
You can get the deeplink Uri in your Activity ‘s onCreate() method as well as the corresponding properties:
Deferred deeplink
When using Play Store url or Market scheme or Firebase Dynamic Links methods, the regular Play Store Open button will be replaced by a Continue button.
Furthermore, a notification will be displayed with Tap to continue content.
These two actions are essential to the Deferred deeplink method as they provide the initial data to the app.
Regular Deeplink | Deferred Deeplink |
---|
Url redirections
Adb Activity Manager
To try links with adb, use the Activity Manager (am) command:
Источник