Create an app indexing setup: deep links, deferred deep links, and verification.
- User
Create an app indexing setup: deep links, deferred deep links, and verification.
Assistant
Create an app indexing setup: deep links, deferred deep links, and verification.
The user wants an "app indexing setup" that covers three specific areas:
I need to create a conceptual guide or a "setup" description. Since the user didn't specify a platform (iOS vs. Android) or a specific framework (React Native, Flutter, Native), I should cover both major platforms (Android and iOS) as they are the industry standards. I will also structure the response to cover the "What", "Why", and "How" for each of the three requested components.
Plan:
AndroidManifest.xml and Info.plist / entitlements.assetlinks.json.apple-app-site-association (AASA).Drafting the Content:
autoVerify="true"./.well-known/assetlinks.json.applinks:example.com)./.well-known/apple-app-site-association.Refining the Request: "Create an app indexing setup". This implies code, configuration, and file structure.
Structure:
Self-Correction during drafting:
InstallReferrer. On iOS, it's very hard natively without fingerprinting. I should clarify that "Deferred" usually requires a third-party SDK or a sophisticated backend, but I will show the code required to consume the deferred link data.Let's write the response. I will structure it as a comprehensive implementation guide covering Native Android (Kotlin) and Native iOS (Swift), as that is the base for any cross-platform framework.
Step-by-step Guide:
example.com.AndroidManifest.xml: Add intent-filter with autoVerify.strings.xml: (Optional, but good practice).assetlinks.json.apple-app-site-association.onNewIntent.userActivity(_:continue:).Let's generate. This is a comprehensive guide to setting up App Indexing (Google) and Universal Links (Apple). This setup enables standard Deep Links, Verified Universal Links (no permission dialogs), and Deferred Deep Links (context preservation after install).
We will cover:
assetlinks.json (Android) and apple-app-site-association (iOS).To enable "Verified" links (links that open your app directly without a disambiguation dialog), you must host a JSON file on your website at a specific path. This proves you own both the app and the website.
assetlinks.json)Location: https://<your-domain>/.well-known/assetlinks.json
You must generate a SHA-256 fingerprint from your app's signing certificate (Play Store App Signing key + your Upload key).
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.example.app",
"sha256_cert_fingerprints": [
"14:6D:E9:83:C5:BB:68:... (YOUR SHA-256 KEY)"
]
}
}
]
apple-app-site-association)Location: https://<your-domain>/.well-known/apple-app-site-association (or root).
Note: This file must have no file extension and must be served with Content-Type: application/json.
{
"applinks": {
"details": [
{
"appIDs": ["TEAMID.com.example.app"],
"components": [
{
"/": "/products/*",
"comment": "Matches any product URL"
},
{
"/": "/invite/*",
"comment": "Matches referral links"
}
]
}
]
}
}
AndroidManifest.xml)Add an intent-filter to your main activity. The autoVerify="true" attribute tells Android to check your website for the assetlinks.json file immediately upon installation.
<activity android:name=".MainActivity" ...>
<!-- Standard HTTP/HTTPS Launch -->
<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" />
<!-- Accepts URIs that begin with "https://www.example.com" -->
<data android:scheme="https" android:host="www.example.com" />
</intent-filter>
</activity>
applinks:www.example.com.When the app opens via a link, you need to capture the URL string and route the user.
In your MainActivity.kt:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Check if app was launched from a link
val uri = intent.data
uri?.let { handleDeepLink(it) }
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
// Handle links when app is already running in background
val uri = intent.data
uri?.let { handleDeepLink(it) }
}
private fun handleDeepLink(uri: Uri) {
// Example: https://www.example.com/product/123
if (uri.path?.startsWith("/product") == true) {
val productId = uri.lastPathSegment // "123"
// Navigate to Product Screen
}
}
In your AppDelegate.swift or SceneDelegate.swift:
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else { return }
handleDeepLink(url)
}
func handleDeepLink(_ url: URL) {
// Example: https://www.example.com/product/123
let pathComponents = url.pathComponents
if pathComponents.contains("product") {
// Extract ID and navigate
}
}
The Problem: Standard deep links work if the app is installed. If a user clicks a link, goes to the App Store, installs the app, and opens it, the link context is usually lost.
The Solution: Since iOS and Android restrict cross-identifier tracking, the industry standard is to use Fingerprinting or a 3rd Party Service (like Branch.io, AppsFlyer, or Firebase Dynamic Links *deprecated).
However, you can build a basic deferred logic using Install Referrer (Android) and Clipboard / Server Matching (iOS).
Android (The "Native" Way): Use the Google Play Install Referrer API.
https://play.google.com/store/apps/details?id=com.example.app&referrer=product_id_123iOS (The "Deferred" Challenge): Apple does not pass parameters through the App Store.
Example Code using a Generic Deferred Provider:
// In your App Initialization (e.g., React Native, Flutter, or Native)
DeferredLinkClient.checkForDeferredLink { result in
if let deepLinkUrl = result {
// User installed app via a link 5 minutes ago
// Route them immediately to the specific product page
handleDeepLink(deepLinkUrl)
} else {
// Normal launch, go to Home Screen
loadHomeScreen()
}
}
assetlinks.json and apple-app-site-association on your HTTPS domain.autoVerify="true" intent filter to Manifest.onNewIntent (Android) and scene(continue:) (iOS) to parse URLs.