Mastering Deep Links on Android: From URL Schemes to Deferred Deeplinks
This guide explains what deep links are, why they matter for mobile apps, the various deep‑linking techniques (URL schemes, App/Universal Links, H5 links, and deferred deep links), and provides step‑by‑step Android implementation examples with code snippets.
What is a Deep Link?
A deep link is a URI that navigates a user directly to a specific screen or feature inside a mobile app, as defined by the Android documentation.
Why Deep Links are Needed
Mobile users typically interact with a limited set of apps. Deep links enable traffic exchange between apps and advertising SDKs, allowing seamless navigation without requiring the user to manually open the target app.
Common Deep‑Linking Techniques
URL Scheme – custom scheme such as myapp://path?param=value.
App Links (Android) / Universal Links (iOS) – HTTP/HTTPS links that fall back to a web page when the app is not installed.
H5 (Web) Links – an intermediate web page that decides whether to open the app, download the APK, or stay in the browser.
Deferred Deep Link – preserves the target page information through the install process so that after installation the user lands on the intended screen.
Platform‑specific schemes – e.g., WeChat Jump, Chrome Intent.
1. URL Scheme
A URL scheme consists of four parts:
Scheme – business identifier (e.g., weixin).
Host – domain or logical host (e.g., dl).
Path – optional page path (e.g., /scan).
Query – key‑value parameters (e.g., level=1&light=1).
Example: weixin://dl/scan?level=1&light=1 Limitations:
Cannot handle the case where the target app is not installed.
Multiple apps may claim the same scheme, forcing the user to choose.
2. App Links / Universal Links
These link a website to the app. When the app is installed, the link opens the in‑app location; otherwise it opens the associated web page. Using HTTP/HTTPS avoids scheme collisions.
Note: Some Android apps (e.g., WeChat) intercept these URLs and do not forward them to the system, limiting their effectiveness.
3. H5 Links
An H5 page can decide at runtime whether to:
Open the app via a custom scheme or App Link.
Trigger a direct APK download (if allowed).
Redirect to a browser fallback.
The extra web step may introduce friction, but it provides flexible control over the launch flow.
4. Deferred Deep Link
Deferred deep links retain the original deep‑link parameters through the install flow. Common implementations:
Clipboard – store parameters in the clipboard during download and read them after the app launches.
Device‑fingerprint matching – record IP, OS, device IDs, etc., and match pre‑install clicks with post‑install opens.
5. Platform‑Specific Schemes
WeChat Jump – WeChat blocks normal URLs; a special adaptation is required.
Chrome Intent – newer Chrome versions require a specific Intent URI format.
Practical Android Implementation
1. Register Intent Filters in AndroidManifest
Declare both an App Link (HTTP) and a custom scheme:
<activity android:name="com.example.android.GizmosActivity" android:label="@string/title_gizmos">
<intent-filter android:label="@string/filter_view_http_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.example.com" android:pathPrefix="/gizmos" />
</intent-filter>
<intent-filter android:label="@string/filter_view_example_gizmos">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="example" android:host="gizmos" />
</intent-filter>
</activity>2. Retrieve Parameters from the Intent
In the activity, extract the data URI and query parameters:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
Uri data = intent.getData(); // e.g., example://gizmos?level=1
if (data != null) {
String level = data.getQueryParameter("level");
// Use the parameter as needed
}
}3. Test the Deep Link with ADB
Run the following command, replacing <URI> with the deep‑link URL and <PACKAGE> with the app’s package name:
$ adb shell am start -W -a android.intent.action.VIEW -d <URI> <PACKAGE>Conclusion
Deep linking on Android can be implemented via custom URL schemes, App Links, H5 entry pages, or deferred deep links. Each method has trade‑offs regarding install‑time handling, URL collisions, and user friction. The code snippets above illustrate how to register intent filters, extract parameters, and verify the configuration with ADB, providing a concrete foundation for integrating deep links into Android applications.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
