CORE JSC

International Technology Partnership

Mobile Development

Fixing React Native Android Deep Links That Work From a Cold Start but Fail When the App Is Already Running

Tapping a deep link when the app isn't running opens it straight to the right screen, every time. Tapping the exact same link while the app is already open in the background does something else entirely — nothing happens, the app just comes to the foreground on whatever screen it was already on, or it even relaunches from scratch. The intent filter and the domain verification are both fine; the problem is what the Activity's launch mode does with a second intent arriving while it's already alive.

Core JSC Team·November 24, 2026
React NativeAndroidDeep LinkingNavigationMobile Development

The Problem

A deep link into a React Native Android app — opened from a notification, another app, or a browser — correctly launches the app and navigates to the intended screen when the app wasn't already running. Tapping the exact same link a second time while the app is still open, sitting in the background, produces a different and visibly wrong result: the app simply comes to the foreground showing whatever screen it was already on, as if the link had no effect at all, or in some cases the app appears to restart entirely, losing whatever state it had. The link itself, its intent filter, and the domain verification are all functioning correctly — something about handling a second incoming intent while the Activity is already alive is the actual gap.

Why It Happens

Android's launch mode determines whether a new intent reuses the existing Activity instance or creates a new one, and the default doesn't reuse it the way deep linking needs

By default, an Activity uses the standard launch mode, which creates a brand-new instance of the Activity for every incoming intent, stacking it on top of whatever was already there — this is fine for normal app navigation, but for a deep link arriving while the app is already running, it means a second Activity instance gets created rather than the existing, already-initialized one being reused and told about the new link.

Without singleTask (or an equivalent launch mode) and an onNewIntent handler, the existing Activity has no way to learn about a deep link that arrives while it's already running

The singleTask launch mode changes this behavior so that a new intent targeting an Activity that already has a running instance is routed to that existing instance via its onNewIntent() callback, instead of creating a new instance. Without this launch mode set, and without an onNewIntent override that actually processes the new intent's data, the already-running Activity simply comes to the foreground with no awareness that a new deep link URL arrived at all — explaining exactly the "nothing happens, it just foregrounds" symptom.

React Native's own Linking module only surfaces a new URL automatically in specific circumstances, and a missing manual listener setup silently drops the rest

React Native's Linking API provides Linking.getInitialURL() for the link that originally launched the app, and a url event (via Linking.addEventListener) for links received while the app is already running — but this event only fires if the native side's onNewIntent actually forwards the intent's data into the bridge in the first place. A project that only ever reads getInitialURL() and never sets up the url event listener, or whose native onNewIntent never calls the method that forwards the intent to React Native, will never see a warm-start deep link at the JavaScript level no matter how correctly the native launch mode is configured.

The Fix

1. Set the launch mode to singleTask on the main Activity in the Android manifest

<activity
    android:name=".MainActivity"
    android:launchMode="singleTask"
    ... >
</activity>

This is the foundational fix — without it, every incoming deep link while the app is running creates a new Activity instance regardless of anything done at the JavaScript or onNewIntent level, so no amount of fixing the React Native side alone resolves the problem if this manifest setting is missing.

2. Override onNewIntent in the native Activity to forward the new intent's data to React Native's bridge

// MainActivity.java (or .kt)
@Override
public void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
    // For React Native's Linking module to receive this as a 'url' event:
    getReactInstanceManager()
        .onNewIntent(intent);
}

Without this override explicitly present and correctly forwarding the intent, singleTask alone only stops a duplicate Activity from being created — it doesn't by itself get the new URL to React Native's JavaScript layer at all, since that forwarding step has to be written explicitly rather than happening automatically.

3. Subscribe to the Linking module's url event in JavaScript, separately from reading the initial URL

useEffect(() => {
  // Handles the link that originally launched the app (cold start)
  Linking.getInitialURL().then((url) => {
    if (url) handleDeepLink(url);
  });

  // Handles a link received while the app is already running (warm start)
  const subscription = Linking.addEventListener("url", ({ url }) => {
    handleDeepLink(url);
  });

  return () => subscription.remove();
}, []);

Cold-start and warm-start links are two genuinely separate code paths in React Native's own Linking API, and a project that only implemented the cold-start path (often because that's the one tested first and the one that "just works" by default) needs the url event listener added explicitly — it isn't something getInitialURL() alone ever covers.

4. Test specifically by backgrounding the app and tapping the link again, rather than only testing from a fully closed state

Test sequence: open the link once (cold start, app not running) -> confirm
correct navigation -> background the app (don't close it) -> tap the same
link again -> confirm it navigates correctly a second time, from the warm state.

Because the cold-start path works correctly by default in most setups, testing only that path can leave the warm-start gap entirely unnoticed through development — explicitly testing the "app already running" case is what actually surfaces this class of bug before it reaches production.

Why This Works

The cold-start and warm-start deep-link paths are genuinely two different code paths — one handled by the app's normal launch sequence and getInitialURL(), the other requiring singleTask launch mode, an explicit onNewIntent override, and a separate url event listener — and a project that only implemented the first one will reliably work for the case most likely to be tested first while silently failing the second. Setting the launch mode, forwarding the intent natively, and subscribing to the url event together complete the second path rather than leaving it as the one that was never built.

Conclusion

A deep link that works when the app launches fresh but fails while the app is already running is a missing warm-start handling path, not a problem with the link, the intent filter, or domain verification. Setting singleTask launch mode, forwarding the new intent through onNewIntent, and subscribing to React Native's url event alongside getInitialURL() together close the gap between a deep link that works once and one that works reliably every time, regardless of whether the app was already running.