Push Notifications with Firebase Cloud Messaging
Send real device push notifications to a React Native app using Firebase Cloud Messaging.
This guide covers wiring Firebase Cloud Messaging (FCM) into a React Native app for real device push notifications.
Quick Answer
Request notification permission in the app, register the device's FCM token, save it against the signed-in user on your backend, upload an APNs key for iOS, then send messages from your server with the Firebase Admin SDK.
1. Confirm Cloud Messaging Is Available
Cloud Messaging is enabled automatically with every Firebase project there's no separate toggle. Confirm it under Project Settings → Cloud Messaging.
2. Request Notification Permission
The app must request permission before it can receive notifications (required on iOS, and on Android 13+). Ask at a point in the flow where the user understands why, not on cold first launch permission denied once is hard to recover from.
3. Register and Store the Device Token
Once permission is granted, the client SDK returns a device token. Send it to your backend and store it against the current user so you know who to notify later. Tokens rotate, so re-send on refresh and on each sign-in.
4. iOS-Specific Setup
- In Xcode, enable the Push Notifications capability and Background Modes → Remote notifications.
- In your Apple Developer account, create an APNs authentication key.
- Upload that key under Firebase Project Settings → Cloud Messaging, so Firebase can deliver through Apple's push service.
Without the APNs key, iOS tokens register successfully but no notification ever arrives which makes this the single most common iOS push bug.
5. Send from Your Backend
Using the Firebase Admin SDK server-side:
admin.messaging().send({
token: deviceToken,
notification: { title: 'Order update', body: 'Your order is on the way.' },
});
Never put service account credentials in the app. Sending happens from your server.
6. Handle All Three App States
Foreground, background, and killed are three separate code paths in FCM. A notification that works in the background but does nothing in the foreground usually means the foreground handler isn't implemented.
Common Issues
Token registers but nothing arrives on iOS no APNs key uploaded to Firebase, or the Push Notifications capability isn't enabled in Xcode.
Nothing arrives on the iOS simulator expected. Real device tokens don't deliver to the simulator; test on a physical device.
Works in background, silent in foreground the foreground message handler isn't wired up.
Worked yesterday, silent today the device token rotated and your backend still has the old one.
Verification Checklist
- the app requests and receives notification permission;
- a device token is generated and stored on your backend;
- an APNs key is uploaded to Firebase (iOS);
- Push Notifications capability is enabled in Xcode (iOS);
- a test message from the Admin SDK arrives on a real device;
- foreground, background, and killed states are all handled.