React Native push notifications
Register iOS and Android devices for push notifications with the PostHog React Native SDK, and capture when users open them. Before you start, connect a push channel.
Requirements
posthog-react-native4.62.0 or later.- The
@posthog/react-native-pluginpackage, 2.3.0 or later. Later sections give the versions that some features need. - Push set up in your app, for example with
@react-native-firebase/messaging, and notification permission from the user. - iOS 14 or later for automatic registration and open capture on iOS.
Push isn't supported on React Native Web or macOS.
CocoaPods is becoming read-only. CocoaPods trunk becomes read-only on December 2, 2026, and
posthog-ios4.0 and later is only published through Swift Package Manager (SPM).
@posthog/react-native-plugin3.0 and later always resolvesposthog-iosthrough SPM, including on the CocoaPods path, so upgrading the plugin is enough. See Upgrading to@posthog/react-native-plugin3.0.Plugin 2.x stays on
posthog-ios3.x on every iOS dependency path, including the hybrid and full SPM setups, so switching paths doesn't bring newer iOS SDK versions. To getposthog-ios4.0 and later, upgrade to plugin 3.0.This change doesn't affect
@posthog/react-native-pluginreleases on npm or Android.
Register the device
With the plugin installed, the SDK registers the device and captures opens by default:
On iOS, the SDK registers the APNs token under your bundle ID when your app registers for remote notifications. On Android, it fetches the FCM token at startup and registers it under your Firebase project ID.
iOS reports a notification tap only to UNUserNotificationCenter.current().delegate. If nothing in your app sets one, the SDK can't capture any opens on iOS.
The Android startup fetch doesn't see later token changes, so forward them:
Register manually
If you manage tokens yourself, set capturePushNotificationSubscriptions to false and register the token:
You can call it before the SDK finishes setup. The SDK queues the call. Without an appId, iOS registers an APNs token under your bundle ID, and Android registers an FCM token under your Firebase project ID. To register an FCM token on iOS, pass your Firebase project ID. See iOS apps that send through Firebase.
If you don't call posthog.reset() at sign-out, unregister the device yourself:
Capture opens
The SDK captures every tap on a remote notification, whether it launches the app or arrives while the app runs. Some cases need a recent plugin version:
- iOS taps that launch the app need
@posthog/react-native-plugin2.9.2 or later. The plugin installs its hook at launch, before your JavaScript runs. - Android taps while the app runs need
@posthog/react-native-plugin2.6.0 or later. Earlier versions capture only taps that launch the app. - Android taps after the process is killed need an
onNewIntentoverride. See below.
On Android, the SDK recognizes a tap by the google.message_id extra that Firebase puts on the intent, so it can't see push delivered outside FCM. It also can't see locally scheduled notifications, or notifications that your app draws from a foreground message. Capture those yourself:
Don't call it from messaging().onNotificationOpenedApp or getInitialNotification(), because the SDK already captures those taps. From @posthog/react-native-plugin 2.9.1, the manual call skips a notification that PostHog sent if the SDK captured it in the last 5 minutes. A handler that you add for other notifications still counts them twice. If you added an onNotificationOpenedApp handler for Android on an older plugin version, remove it when you upgrade.
The native SDK builds and sends $push_notification_opened, so your JavaScript before_send never sees it. Remove sensitive content before you pass it to capturePushNotificationOpened.
Android taps after the process is killed
When Android kills your app's process but keeps its task in the recent apps list, React Native drops the tap's intent. No library in the app can see the tap, including PostHog, @react-native-firebase/messaging, and your deep links. An onNewIntent override in your MainActivity fixes all three.
With the posthog-react-native/expo config plugin, expo prebuild adds the override for you, from posthog-react-native 4.74.0. To turn this off, set patchMainActivityNewIntent to false:
In a bare React Native app, add the override to MainActivity.kt yourself. Call setIntent(intent) before super, or React Native drops the intent first:
If your MainActivity already overrides onNewIntent, the config plugin doesn't change it and logs a warning. Add setIntent(intent) as the first line of your override.
Identity verification
If your channel uses identity verification, return a token from your backend through pushIdentityProvider:
Opt out
Set capturePushNotificationSubscriptions or capturePushNotificationOpened to false in the options.
On iOS, the plugin installs its launch hook before your JavaScript runs, so capturePushNotificationOpened: false stops the event but not the hook. To skip the hook, set com.posthog.posthog.CAPTURE_PUSH_NOTIFICATION_OPENED to false in Info.plist, or in ios.infoPlist on Expo:
Troubleshooting
| Problem | What to check |
|---|---|
| The token never registers | @posthog/react-native-plugin is installed. On Android, Firebase Messaging is on the classpath, which @react-native-firebase/messaging sets up. |
| Opens aren't captured on iOS | Your app sets UNUserNotificationCenter.current().delegate, and the device runs iOS 14 or later. For taps that launch the app, use plugin 2.9.2 or later. |
| Opens aren't captured on Android | The push goes through FCM. Use plugin 2.6.0 or later for taps while the app runs, and override onNewIntent for taps after the process is killed. |
For problems that apply to every SDK, see push troubleshooting.





