Set Up Push Notifications
Instamobile React Native apps use Firebase Cloud Messaging for push notification delivery on Android and iOS. The mobile app registers for notifications and stores device tokens. A trusted backend sends notifications to those tokens.
Quick Answer
Do not put Firebase server keys or service account secrets in the React Native app. Configure your Firebase project, upload APNs credentials for iOS, install the correct Firebase config files, and send notifications from Firebase Functions or another trusted backend using the Firebase Admin SDK or FCM HTTP v1 API.
Official references:
- Firebase Cloud Messaging for iOS
- Firebase Cloud Messaging for Android
- Migrate from legacy FCM APIs to HTTP v1
- Build FCM send requests
How Push Works
| Part | Responsibility |
|---|---|
| React Native app | Requests permission, receives an FCM token, stores or updates the token for the signed-in user. |
| Firebase project | Owns iOS and Android app registrations, GoogleService-Info.plist, google-services.json, and APNs credentials. |
| Backend | Sends push messages with Firebase Admin SDK or FCM HTTP v1. |
| Firestore | Stores user notification preferences and device tokens if your app uses Firebase. |
| APNs | Delivers notifications to iOS devices through Firebase's APNs integration. |
Required Setup
- Create your Firebase project.
- Add the iOS app with the production bundle identifier.
- Add the Android app with the production package name.
- Replace
GoogleService-Info.plist. - Replace
google-services.json. - Configure APNs for iOS.
- Confirm notification permissions and token registration in the app.
- Send notifications from a trusted backend.
- Test on real devices before store submission.
Backend Sending
If your app includes Firebase Functions, use the Firebase Admin SDK from Functions to send notifications. If your backend is not Firebase, use the FCM HTTP v1 API from a trusted server.
Never send push notifications directly from the mobile app with a server key.
Search your source code for these notification entry points:
rg "sendPushNotification|notificationManager|messaging\\(|getToken|onMessage"
Typical send locations:
- new chat message;
- new friend request;
- order status changed;
- driver dispatch event;
- appointment booking update;
- admin announcement;
- media or comment notification.
Production Safety Checklist
- No FCM server key or service account JSON is committed to the mobile app.
- Backend uses Firebase Admin SDK or FCM HTTP v1.
- Notification sends are authenticated.
- Users can opt out of non-critical notifications if required by your product.
- Device tokens are refreshed when Firebase returns a new token.
- Invalid tokens are removed after send failures.
- Notification content does not expose private data on the lock screen.
- Push flows are tested on real iOS and Android devices.
- Store privacy forms disclose notification usage.