Setup Deep Linking
Learn how to set up deep linking with subdomains and custom URI schemes in your React Native and Flutter apps
Deep links allow users to navigate directly to specific content within your app by clicking on a URL. There are two primary approaches to deep linking:
- HTTP/HTTPS Deep Links (including subdomains): URLs with
http://
orhttps://
protocols that can open your app when clicked. - Custom URI Schemes: URLs with a custom protocol like
myapp://
that are registered to your app.
This guide covers how to implement both methods for React Native and Flutter applications, and how they can be used together for a comprehensive deep linking strategy.
HTTP/HTTPS Deep Linking with Subdomains
When using subdomains for deep linking, you can create a structured approach to handle different sections or features of your app.
React Native uses React Navigation for handling navigation and deep linking.
Step 1: Configure your app to handle HTTP/HTTPS links
First, you need to modify your Android and iOS configurations to handle subdomain links.
Open your android/app/src/main/AndroidManifest.xml
file and add the following inside the <activity>
section:
Step 2: Configure React Navigation
In your navigation configuration:
Custom URI Schemes for Deep Linking
Custom URI schemes provide an alternative method for deep linking, allowing your app to handle URLs with a custom protocol like myapp://
. While HTTP/HTTPS deep links are generally recommended for production apps, custom URI schemes can be useful in specific scenarios or for backward compatibility.
Step 1: Configure your app to handle custom URI schemes
Open your android/app/src/main/AndroidManifest.xml
file and add the following inside the <activity>
section:
Testing Your Deep Links
Use adb
for Android testing: