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.
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:
Open your android/app/src/main/AndroidManifest.xml
file and add the following inside the <activity>
section:
- Open your iOS project in Xcode
- Go to the “Info” tab
- Add a new entry to the URL Types section
- Configure your URL schemes based on your domains and subdomains
- In your
Info.plist
file, add:
Step 2: Configure React Navigation
In your navigation configuration:
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:
Open your android/app/src/main/AndroidManifest.xml
file and add the following inside the <activity>
section:
- Open your iOS project in Xcode
- Go to the “Info” tab
- Add a new entry to the URL Types section
- Configure your URL schemes based on your domains and subdomains
- In your
Info.plist
file, add:
Step 2: Configure React Navigation
In your navigation configuration:
Flutter uses go_router or its own navigation system to handle deep links.
Step 1: Configure your app to handle HTTP/HTTPS links
Modify your android/app/src/main/AndroidManifest.xml
file:
Modify your android/app/src/main/AndroidManifest.xml
file:
Update your ios/Runner/Info.plist
file:
Step 2: Configure your router to handle deep links
If you’re using go_router
:
Step 3: Use Linkrunner SDK to handle incoming links
The Linkrunner SDK provides methods to manage and track deep links:
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:
Open your android/app/src/main/AndroidManifest.xml
file and add the following inside the <activity>
section:
- Open your iOS project in Xcode
- Go to the “Info” tab
- Add a new entry to the URL Types section with:
- Identifier: Your app bundle identifier (e.g.,
com.example.myapp
) - URL Schemes: Your custom scheme (e.g.,
myapp
)
- Identifier: Your app bundle identifier (e.g.,
- In your
Info.plist
file, it should look like:
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:
Open your android/app/src/main/AndroidManifest.xml
file and add the following inside the <activity>
section:
- Open your iOS project in Xcode
- Go to the “Info” tab
- Add a new entry to the URL Types section with:
- Identifier: Your app bundle identifier (e.g.,
com.example.myapp
) - URL Schemes: Your custom scheme (e.g.,
myapp
)
- Identifier: Your app bundle identifier (e.g.,
- In your
Info.plist
file, it should look like:
Step 1: Configure your app to handle custom URI schemes
Modify your android/app/src/main/AndroidManifest.xml
file:
Modify your android/app/src/main/AndroidManifest.xml
file:
Update your ios/Runner/Info.plist
file:
Testing Your Deep Links
Use adb
for Android testing:
Use adb
for Android testing:
Use simulator URL schemes for iOS testing:
Create actual links on your website and test on real devices:
- For HTTP/HTTPS links:
https://app.example.com/profile/123
- For custom URI schemes:
myapp://profile/123