Deep Linking & Universal Links — Mobile

rinislaundry://order/13 (a custom scheme) opens src/app/order/[id].tsx through Expo Router with no configuration, but it's a dead end without the app…

Mrs. Rini sends Wulan a WhatsApp message with a link to Order #13. Wulan taps it, and what opens is the Order #13 screen inside the app, not its front screen. A link like that is a deep link: a link that opens one specific screen inside the app, not just the app. Think of a laundry receipt: "come to the shop" opens the app, "pick it up from shelf 13" is a deep link. And if Wulan doesn't have the app yet, a good link still takes her somewhere useful: the Order #13 web page.

Three kinds of links to Order #13

Link Kind App installed Not installed
rinislaundry://order/13 custom scheme Order #13 opens nothing can open it
https://rinislaundry.com/order/13 on an iPhone Universal Link Order #13 opens the Order #13 web page
https://rinislaundry.com/order/13 on Android App Link Order #13 opens the Order #13 web page

A custom scheme is easy to set up, but another app can register the same scheme, and without the app the link is a dead end. Universal Links and App Links are plain HTTPS addresses proven to be yours by a file on your domain, so they have a web fallback.

Expo Router: a link straight to a screen

scheme: "rinislaundry" has been in app.json since the setup lesson, and Expo Router builds routes from files. So with no configuration at all, rinislaundry://order/13 opens src/app/order/[id].tsx with { id: '13' }. Expo Router joins the link's host and path (order + /13) into order/13. The HTTPS link https://rinislaundry.com/order/13 has its origin dropped, giving /order/13, the same route.

$ npx uri-scheme list
› iOS: Schemes for config: ./ios/RinisLaundry/Info.plist
› rinislaundry://
› com.rinislaundry.app://

› Android: Schemes for config: ./android/app/src/main/AndroidManifest.xml
› rinislaundry://
› https://

That's the output in this project after npx expo prebuild. Prebuild also registers the bundle ID as a second scheme, and https:// shows up on Android because of the App Link below. To try it on a development build:

npx uri-scheme open rinislaundry://order/13 --android
npx uri-scheme open rinislaundry://order/13 --ios
adb shell am start -W -a android.intent.action.VIEW -d "rinislaundry://order/13" com.rinislaundry.app

In Expo Go, the scheme belongs to Expo Go: exp://127.0.0.1:8081/--/order/13. The part after /--/ is the path in your app. A link to a route that doesn't exist (say rinislaundry://orders/13) shows the built-in "Unmatched Route" screen, or your own screen in src/app/+not-found.tsx.

Universal Links on iOS

Both sides have to vouch for each other. In the app:

{ "expo": { "ios": { "bundleIdentifier": "com.rinislaundry.app", "associatedDomains": ["applinks:rinislaundry.com"] } } }

Prebuild writes it into the entitlements as com.apple.developer.associated-domains holding applinks:rinislaundry.com (no https://). On the web, the file https://rinislaundry.com/.well-known/apple-app-site-association:

{
  "applinks": {
    "details": [
      {
        "appIDs": ["A1B2C3D4E5.com.rinislaundry.app"],
        "components": [{ "/": "/order/*", "comment": "Order detail opens in the app" }]
      }
    ]
  }
}

One more before moving on. The Universal Link is set up correctly and the app is installed, then Wulan types https://rinislaundry.com/order/13 into Safari's address bar. Guess: does the app open?

Typing an address straight into the address bar is navigation inside the browser, and it never opens the app. Safari opens the web page. A Universal Link works when the link is tapped in another app: WhatsApp, email, Notes.

App Links on Android

{ "expo": { "android": { "package": "com.rinislaundry.app", "intentFilters": [{
  "action": "VIEW",
  "autoVerify": true,
  "data": [{ "scheme": "https", "host": "rinislaundry.com", "pathPrefix": "/order" }],
  "category": ["BROWSABLE", "DEFAULT"]
}] } } }

Prebuild writes an <intent-filter android:autoVerify="true"> with android:host="rinislaundry.com" and android:pathPrefix="/order" into AndroidManifest.xml. On the web, https://rinislaundry.com/.well-known/assetlinks.json, served with the application/json content type:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": { "namespace": "android_app", "package_name": "com.rinislaundry.app", "sha256_cert_fingerprints": ["SHA256_CERTIFICATE_FROM_EAS_CREDENTIALS"] }
}]

When the app isn't installed

Universal Links and App Links fall back to the browser, so https://rinislaundry.com/order/13 must really exist as a web page: Order #13's status after login, plus an invitation to install the app. On an iPhone, <meta name="apple-itunes-app" content="app-id=..."> on that page shows an App Store banner. A custom scheme has no fallback like this, so send HTTPS links in WhatsApp and email, not rinislaundry://. If Wulan only installs the app from that banner, its first launch doesn't carry the Order #13 link: carrying it is called deferred deep linking and needs an extra service. Firebase Dynamic Links, which many tutorials still use for this, shut down on 25 August 2025, and its links now answer 404.

Never trust the id in a link

Anyone can build the link rinislaundry://order/12, and #12 is Mr. Darto's order. The detail screen checks the id's shape, then asks the server, which only answers with the logged-in account's orders:

// src/app/order/[id].tsx
export default function OrderDetail() {
  const { id } = useLocalSearchParams<{ id: string }>();
  const validId = /^\d{1,6}$/.test(id ?? ''); // a link can hold anything

  const { data, isPending, isError } = useQuery({
    queryKey: ['orders', id],
    queryFn: () => fetchOrder(id), // GET /api/orders/{id}: 404 for someone else's order
    enabled: validId,
    retry: false,
  });

  if (!validId || isError) return <Text>Order not found</Text>;
  if (isPending) return <ActivityIndicator />;
  return <Text>{data.name}: {data.status}</Text>;
}

⚠️ Why does the link open the browser, not the app?

TL;DR: rinislaundry://order/13 (a custom scheme) opens src/app/order/[id].tsx through Expo Router with no configuration, but it's a dead end without the app. https://rinislaundry.com/order/13 is a Universal Link (iOS: associatedDomains: ["applinks:rinislaundry.com"] plus /.well-known/apple-app-site-association with appIDs and components, HTTPS with no redirects, fetched by Apple's CDN) and an App Link (Android: intentFilters with autoVerify: true plus /.well-known/assetlinks.json holding the package and SHA-256 fingerprint), which falls back to the web page when the app isn't installed. Test with npx uri-scheme open, adb shell am start and adb shell pm get-app-links; test a Universal Link by tapping it in Notes, because typing in the address bar never opens the app. Never trust the id in a link: check its shape and let GET /api/orders/{id} answer 404 for someone else's order.

⚡ A link straight to a screen

Write:

npx uri-scheme open rinislaundry://order/13 --android

Meaning: With scheme in app.json and the file src/app/order/[id].tsx, Expo Router opens the Order #13 screen with { id: '13' }, with no more configuration. But a custom scheme is a dead end when the app isn't installed.

⚡ HTTPS with a web fallback

Meaning: https://rinislaundry.com/order/13 is a Universal Link on iOS and an App Link on Android: a plain HTTPS address proven to be yours by a file on your domain. Without the app, this link falls back to the Order #13 web page. So send HTTPS links in WhatsApp, not rinislaundry://.

⚡ Typed, not tapped

Guess first: the Universal Link is set up correctly and the app is installed, then Wulan types https://rinislaundry.com/order/13 into Safari's address bar. Does the app open?

No. Typing into the address bar is navigation inside the browser, so Safari opens the web page. A Universal Link works when it's tapped in another app: WhatsApp, email, Notes.

⚡ Never trust the id in a link

Write:

const validId = /^\d{1,6}$/.test(id ?? ''); // a link can hold anything

Meaning: Anyone can build rinislaundry://order/12, and #12 is Mr. Darto's order. Check the id's shape, then let the server answer 404 for someone else's order.

What you will learn