Configure and implement deep linking, universal links, and app links for seamless navigation from web, email, social media, and other apps into your mobile application.
## ROLE You are a mobile deep linking specialist who has configured link routing systems for applications with millions of daily link clicks. You understand the intricacies of Apple Universal Links, Android App Links, deferred deep linking, and the attribution challenges that come with iOS privacy changes and Android intent resolution. ## OBJECTIVE Implement a complete deep linking system for a [APP_TYPE: e-commerce/content/social/fintech] mobile application that handles navigation from [LINK_SOURCES: web/email/social media/SMS/QR codes/ads] directly to the correct in-app content. The system must work across iOS and Android with graceful fallbacks for users who do not have the app installed. ## TASK ### Step 1: Link Architecture Design Define the deep link URL structure: - Universal Link domain: [YOUR_DOMAIN] (e.g., https://app.example.com) - Custom URI scheme: [YOUR_SCHEME]:// (e.g., myapp://) for backward compatibility - Path mapping table: - /product/[PRODUCT_ID] -> Product detail screen - /profile/[USER_ID] -> User profile screen - /category/[CATEGORY_SLUG] -> Category listing screen - /checkout -> Checkout flow - /settings/[SECTION] -> Settings subsection - /[CUSTOM_PATHS] -> [TARGET_SCREENS] - Query parameter handling for UTM tracking, referral codes, and [CUSTOM_PARAMS] - Fragment-based routing for single-page web app compatibility - Link shortening strategy with [SERVICE: Branch/Firebase Dynamic Links replacement/Bitly/custom] ### Step 2: iOS Universal Links Configuration Set up Apple Universal Links: - Apple App Site Association (AASA) file generation and hosting at .well-known/apple-app-site-association - AASA file content with applinks detail including paths, components, and exclude patterns - Associated Domains entitlement configuration in Xcode: applinks:[YOUR_DOMAIN] - CDN configuration requirements: AASA must be served over HTTPS without redirects, with application/json content type - Debug verification using swcutil and Apple's AASA validator - Handling of Universal Link failures with custom URL scheme fallback - SceneDelegate / AppDelegate handling of NSUserActivity for link activation - iOS 16+ alternate mode and pattern-based matching ### Step 3: Android App Links Configuration Set up Android App Links: - Digital Asset Links file at .well-known/assetlinks.json with package name and SHA-256 fingerprints - Intent filter configuration in AndroidManifest.xml with autoVerify="true" - Multiple domain support if links come from [ADDITIONAL_DOMAINS] - Deep link handling in Activity with intent.data parsing - Navigation component integration for direct fragment/composable routing - Android 12+ intent resolution changes and Web Intent filter handling - Debug verification using adb shell am start and Play Console link verification ### Step 4: Deep Link Router Implementation Build the in-app routing engine: - Central deep link router that maps URL paths to screen destinations - Parameter extraction and type validation (numeric IDs, slugs, UUIDs) - Authentication-gated links: queue the deep link, present login, then navigate after auth - Expired or invalid content handling with graceful error screens - Nested navigation state restoration (e.g., deep link to a reply within a thread within a channel) - Race condition handling when deep link arrives during app initialization - Router unit tests covering all path combinations and edge cases ### Step 5: Deferred Deep Linking Handle first-install deep linking: - Deferred deep link flow: ad click -> App Store/Play Store -> install -> first launch -> navigate to original content - Clipboard-based deferred linking (iOS pasteboard detection with user consent) - Server-side fingerprint matching using IP, device model, and OS version - [ATTRIBUTION_SERVICE: AppsFlyer/Adjust/Branch/Singular] SDK integration for deferred link resolution - Onboarding flow interruption: complete onboarding first, then navigate to deferred content - Conversion tracking from deferred deep link to in-app action ### Step 6: QR Code & NFC Integration Extend deep linking to physical touchpoints: - QR code generation API for dynamic links with embedded tracking parameters - QR code scanning implementation using [CAMERA_FRAMEWORK: AVFoundation/CameraX] - NFC tag reading for [USE_CASE: product info/store check-in/event tickets] - App Clip (iOS) / Instant App (Android) triggers from NFC and QR codes - Offline QR code handling when network is unavailable ### Step 7: Testing & Monitoring Validate and monitor the deep link system: - Test matrix covering: fresh install, app in foreground, app in background, app killed, not installed - Platform-specific testing tools: Apple AASA validator, Android adb deep link testing - Link click-through rate and open rate analytics per source and path - Broken link detection and alerting for content that has been removed - A/B testing of link destinations for marketing campaigns - Debug mode with link inspection overlay showing parsed parameters Provide complete configuration files, server-side code, and mobile implementation for both platforms.
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[YOUR_DOMAIN][YOUR_SCHEME][PRODUCT_ID][USER_ID][CATEGORY_SLUG][SECTION][CUSTOM_PATHS][TARGET_SCREENS][CUSTOM_PARAMS][ADDITIONAL_DOMAINS]