The short version
- Choose which kinds of link you need
- Set the scheme in your app config
- Give each screen a URL with Expo Router
- Host the apple-app-site-association file and add associatedDomains
- Host assetlinks.json and add intentFilters
- Read the URL and its parameters
- Test each kind of link on a build of your app
The three kinds of link
Pick by what should happen when the app is missing. Expo says most apps probably want universal links and app links, and you can set up both a scheme and the verified links in the same project.
| Kind | Looks like | App installed | App missing | You need |
|---|---|---|---|---|
| Custom scheme | myapp://records/42 | Installed | Nothing happens | scheme in app config |
| iOS universal link | https://myapp.io/records/42 | Opens your app | Opens your website | AASA file on your domain, ios.associatedDomains |
| Android app link | https://myapp.io/records/42 | Opens your app, without the chooser dialog | Opens your website | assetlinks.json on your domain, android.intentFilters with autoVerify |
The two verified kinds share one idea, which Expo calls two-way association. Your website proves it belongs to your app with a file, and your app proves it belongs to your website through its signing and its config. That is why they need a domain you control, and a build of your own app.
Step 1: set the scheme
Add a scheme to the app config:
{
"expo": {
"scheme": "myapp"
}
}Make a new development build after adding it. Once the app is installed, myapp:// opens it. If you do not set a scheme, the app uses android.package and ios.bundleIdentifier as schemes. The config reference calls scheme a build-time setting with no effect in Expo Go.
Step 2: let Expo Router map URLs to screens
With Expo Router, every file in src/app is a page with a URL that matches its location. src/app/home.tsx answers myapp://home, or yourapp.com/home on the web. Expo states that deep linking is automatically enabled for all your screens, so you do not write linking config or runtime routing for the link.
A dynamic file such as src/app/records/[id].tsx receives the segment as a route parameter, and anything after a ? arrives as a search parameter. Both come from useLocalSearchParams:
import { Text } from 'react-native';
import { useLocalSearchParams } from 'expo-router';
// File: src/app/records/[id].tsx
// myapp://records/42?tab=notes and https://myapp.io/records/42?tab=notes
export default function Record() {
const { id, tab } = useLocalSearchParams<{ id: string; tab?: string }>();
return <Text>Record {id}, tab {tab}</Text>;
}Two Expo Router details help here. A route group, a directory in parentheses such as (tabs), does not count as part of the URL. And the first index.tsx that matches / is the initial route, so a link with no path opens it. A modal is a route too, so it has a URL; the Expo Router modal guide covers that case. For how this compares with a manual setup, see Expo Router vs React Navigation.
Opening a screen from a notification is the same idea: put the URL in the notification data and push it. The push notifications guide has the tap handler that does it.
If an incoming URL does not match a route, for example one from a third-party service, Expo Router lets you rewrite it in a file named +native-intent.tsx that exports redirectSystemPath. Expo documents it under Customizing links.
Step 3: iOS universal links
Start with the website half. Create apple-app-site-association, with no file extension, inside /.well-known. If you build your website with Expo Router, Expo puts it at public/.well-known/apple-app-site-association. The appID is your Apple Team ID, a dot, then the bundle identifier:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ABCDE12345.com.example.myapp",
"paths": ["/records/*"]
}
]
}
}This sends https://myapp.io/records/* to the app. The *does not match slashes or periods. Expo’s example also shows optional activitycontinuation and webcredentials sections, and a newer components format for iOS 13 and later that can exclude paths. Both are in the Expo iOS guide. Host the file over HTTPS and check that your browser can fetch it.
Then the app half. Add ios.associatedDomains with an applinks: entry and no protocol:
{
"expo": {
"ios": {
"bundleIdentifier": "com.example.myapp",
"associatedDomains": ["applinks:myapp.io"]
}
}
}Build with EAS Build, which Expo says registers the entitlement with Apple for you. Without EAS Build or prebuild you enable the Associated Domains capability by hand. Install the build to trigger verification. iOS downloads the file at install and on updates from the App Store, not on every launch.
Step 4: Android app links
Add android.intentFilters and set autoVerify to true. Expo says autoVerify is required for app links to work correctly:
{
"expo": {
"android": {
"package": "com.example.myapp",
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "myapp.io",
"pathPrefix": "/records"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}Then host assetlinks.json at /.well-known/assetlinks.json (public/.well-known with Expo Router on the web). Serve it over HTTPS with the content type application/json. package_name is your android.package. sha256_cert_fingerprints is the fingerprint of the certificate your build is signed with:
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.example.myapp",
"sha256_cert_fingerprints": [
"14:6D:E9:83:51:7F:66:01:84:93:4F:2F:5E:E0:8F:3A:D6:F4:CA:41:1A:CF:45:BF:8D:10:76:76:CD"
]
}
}
]With EAS Build, run the command below after creating a build, choose the build profile, and copy the value listed under SHA256 Fingerprint. If you sign the app another way, Expo says to read the snippet under Release, Setup, App Signing in the Google Play Console. The array accepts several fingerprints.
eas credentials -p android
Install the app on an Android device to start verification. Expo notes it can take 20 seconds or more. The file format and the verification rules are Google’s, in Verify Android App Links.
Step 5: read the incoming URL
With Expo Router you are done: the matching screen opens and useLocalSearchParams hands it the values. Without Expo Router, for example in an app that uses React Navigation, use expo-linking and install it with npx expo install expo-linking. The useLinkingURL hook returns the link that launched the app, then any later link. Linking.parse splits a URL into hostname, path and queryParams:
import { Text } from 'react-native';
import * as Linking from 'expo-linking';
export default function Home() {
const url = Linking.useLinkingURL();
if (url) {
const { hostname, path, queryParams } = Linking.parse(url);
console.log('Linked with hostname:', hostname, 'path:', path, 'data:', JSON.stringify(queryParams));
}
return <Text>URL: {url}</Text>;
}That hook is the one Expo recommends. Underneath, Linking.getInitialURL() returns the link that launched the app, a promise of a string or null, and Linking.addEventListener('url', callback) reports links that arrive while the app is already open. If you need the manual version, this is the whole of it:
import { useEffect } from 'react';
import * as Linking from 'expo-linking';
function handleUrl(url: string) {
const { path, queryParams } = Linking.parse(url);
// Send the user to the screen that matches path.
}
export function useIncomingLinks() {
useEffect(() => {
// The link that launched the app, or null.
Linking.getInitialURL().then((url) => {
if (url) handleUrl(url);
});
// Links that arrive while the app is already open.
const subscription = Linking.addEventListener('url', ({ url }) => handleUrl(url));
return () => subscription.remove();
}, []);
}The older useURL hook is marked deprecated in the SDK reference in favor of useLinkingURL.
Step 6: test each kind
Test on a build of your own app. Expo recommends development builds for testing linking.
Custom scheme. npx uri-scheme opens a link on a device or simulator. Expo notes that typing a custom-scheme link in a browser address bar may not work, so tap a link on a web page instead:
# A development build with scheme "myapp" npx uri-scheme open myapp://records/42 --ios npx uri-scheme open myapp://records/42 --android # Expo Go uses exp:// and adds /--/ before the path npx uri-scheme open exp://127.0.0.1:8081/--/records/42?hello=world --ios
iOS universal link. Check the file from a terminal first. Then, per Apple’s debugging note, paste the link into the Notes app and long-press it. If everything is right, the options include opening it in your app. Your choice becomes the default for that domain. Apple also lists a Developer settings screen with associated domains diagnostics, where you type a full URL and see whether it is valid for an installed app.
# Is the AASA file reachable, with no 301 or 302? curl -v https://myapp.io/.well-known/apple-app-site-association # Does your server answer an unknown user agent? curl -A "MyAgent-Bot/*" https://myapp.io/.well-known/apple-app-site-association
Android app link.The first command is Expo’s. The other three come from Google’s verification guide and apply to Android 12 and later. A domain that passes shows verified in the output; none means verification may not have finished.
# Open the https link on a device or emulator adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://myapp.io/records/42" com.example.myapp # Android 12 and later: reset, re-verify, then read the result adb shell pm set-app-links --package com.example.myapp 0 all adb shell pm verify-app-links --re-verify com.example.myapp adb shell pm get-app-links com.example.myapp
No website yet.Expo’s guides describe a tunnel for testing before you deploy a site. Put the tunnel domain in associatedDomains and in the intent filter host, then run:
# Test without deploying a website: use a tunnel domain in # associatedDomains and intentFilters, then EXPO_TUNNEL_SUBDOMAIN=my-custom-domain npx expo start --tunnel npx expo run:ios npx expo run:android
When the link opens the browser instead of the app
Work down this list. Each row names a cause and where the fix is documented.
| What you see | What to do | Source |
|---|---|---|
| You typed the link into the browser address bar | Apple says entering a URL directly in the address bar never opens the app. Tap the link from another page or app, or paste it into Notes and tap it there. | Apple TN3155 |
| The link is on your own website, on the same domain | Apple says the browser treats a link to the same domain as normal navigation and keeps the user in the browser. Use a different subdomain for links that should open the app, with its own AASA file and its own associated domain. | Apple TN3155 |
| The AASA file answers 301, 302, 403 or 404 | Apple does not support redirects when it fetches the file, and a 403 or 404 means your site denied access. Run curl -v on the file and host it on each domain and subdomain you list, with public access. | Apple TN3155 |
| associatedDomains has https:// in it, or a port number | Write applinks:myapp.io. Expo calls the https:// prefix a common mistake. Apple says a domain with a port number will not open your app. | Expo iOS guide |
| The path is not in the AASA file | Only listed paths open the app. The * wildcard does not match slashes or periods, so /records/* does not cover /records/42/notes. | Expo iOS guide |
| You changed the AASA file but nothing changed | iOS downloads the file when the app is first installed or updated from the App Store, and does not refresh it often. Expo says changing paths for a production app needs a full app update. | Expo iOS guide |
| The AASA file is larger than 128 KB | Expo lists a limit of 128 KB for the uncompressed file. | Expo iOS guide |
| Android opens the browser, or shows the chooser | Check that the intent filter has autoVerify set to true, that assetlinks.json is served over HTTPS with the content type application/json, and that the fingerprint in the file is the one your build is signed with. Wait 20 seconds or more after installing, because verification takes time. | Expo Android guide |
| It worked on one build and not on another | Each signing certificate has its own fingerprint. The sha256_cert_fingerprints array can hold several, so add one for each variant of your app. Run eas credentials -p android and choose the build profile to read each one. | Expo Android guide |
| You changed web files and the app did not notice | Expo says to rebuild the native app after updating the files, so the device fetches them again. | Expo iOS guide |
| You tested in Expo Go | Expo calls support for incoming links in Expo Go limited. The scheme and the associated domain belong to your own build, so use a development build. | Expo linking overview |
| A custom scheme link does nothing | The scheme is read at build time, so make a new build after you add it. If you never set one, the app uses android.package and ios.bundleIdentifier as schemes. | Expo linking guide |
Expo also suggests an AASA validator and Apple’s debugging note for iOS, and Google’s verification guide for Android.
Where ShipNative fits
ShipNative builds a React Native app from a description, runs it in the browser preview and in Expo Go, and lets you download it as an Expo project. Verified links need a domain you control, files hosted on it, and a build of your own app, so that part is yours to set up in your own Apple, Google and Expo accounts. The downloaded project is a standard Expo project, so the steps above apply to it as written.
