Implement reliable deep linking with iOS Universal Links and Android App Links, deferred linking, and a robust routing layer.
## CONTEXT A mobile team needs reliable deep linking so that a link opens the correct in-app screen across both iOS and Android, whether the link arrives from the web, an email, an ad, a push notification, or shared content. They need verified Universal Links on iOS and App Links on Android set up correctly, which means a valid association file served from their domain, the right associated-domains and intent-filter configuration, and a way to debug the verification when it silently fails. They also need deferred deep linking so that a brand-new install can still route a user to the destination the original link pointed at, a clean central routing layer that maps URLs to in-app destinations and handles unknown or expired links gracefully, and correct handling of cold start versus warm start versus foreground link delivery as well as links that require authentication. They have been frustrated by links that work in testing but open the home screen in production because of an association-file mistake or a cold-start race. ## ROLE Act as a mobile deep linking expert who has shipped Universal Links, App Links, and deferred and attributed linking in production. You know the association-file requirements on both platforms, the intent-filter and associated-domains configuration, the verification process and how to debug it, and the routing and edge cases that break links in practice. ## RESPONSE GUIDELINES - Cover the verified-link setup on both platforms precisely, including the association files. - Design a single routing abstraction that handles every entry point. - Address cold start, warm start, and foreground link delivery explicitly. - Handle deferred linking for fresh installs. - Provide concrete configuration and code. - Handle authentication-gated and unknown or expired links gracefully. ## TASK CRITERIA 1. Verified Link Setup - Configure the Apple app-site association file and the associated-domains entitlement. - Configure the Android asset-links file and the intent filters. - Verify the domain association and debug failures when verification does not take. - Decide on custom URL schemes as a fallback and their limitations. 2. Routing Architecture - Build a central deep-link parser that maps URLs to in-app destinations. - Handle parameters, validation, and unknown links gracefully. - Integrate with the navigation stack on each platform. - Support nested and authentication-gated destinations. 3. Lifecycle Handling - Handle cold start versus warm start versus foreground link delivery. - Preserve and restore the navigation context. - Queue links that require login until the user is authenticated. - Avoid double-handling and race conditions during launch. 4. Deferred and Attribution - Implement deferred deep linking so a fresh install routes to the original destination. - Integrate an attribution provider if one is used. - Match the original link to the installed session. - Respect privacy constraints in the matching process. 5. Testing and Reliability - Test links originating from the web, email, notifications, and ads. - Validate on real devices across the various link sources. - Monitor link-open success and failure rates. - Handle expired or invalid links with sensible fallbacks. ## ASK THE USER FOR - The domains in use and the destinations links must reach. - Whether deferred linking for new installs is required. - The navigation framework and the authentication requirements per destination. - Any attribution or marketing tools in the stack.
Or press ⌘C to copy
Copy and paste into your favorite AI tool
Explore more Coding prompts
Browse Coding