Reference implementation
Browse the full React Native push sample (UI Kit).
What this guide covers
- CometChat Dashboard setup (enable push, add FCM + APNs providers).
- Platform credentials (Firebase for Android/iOS, Apple entitlements).
- Copying the sample notification stack and aligning IDs/provider IDs.
- Native glue for Android (manifest permissions) and iOS (PushKit).
- Token registration, navigation from pushes, testing, and troubleshooting.
What you need first
- CometChat app credentials (App ID, Region, Auth Key) and Push Notifications enabled with an FCM provider (React Native Android) and APNs provider for iOS.
- Firebase project with an Android app (
google-services.jsoninandroid/app) and Cloud Messaging enabled; optional iOS app if you use FCM on iOS. - Apple push setup: APNs
.p8key/cert in CometChat, iOS project with Push Notifications + Background Modes (Remote notifications) permissions. - React Native 0.81+, Node 18+, physical Android + iOS devices for reliable push/call testing.
1. Enable push and add providers (CometChat Dashboard)
- Go to Notifications → Settings and enable Push Notifications.

- Add an FCM provider for React Native Android; upload the Firebase service account JSON and copy the Provider ID.

- Add an APNs provider for iOS and copy the Provider ID.

2. Prepare platform credentials
2.1 Firebase Console
- Register your Android package name (same as
applicationIdinandroid/app/build.gradle) and downloadgoogle-services.jsonintoandroid/app. - Enable Cloud Messaging.

2.2 Apple Developer portal
- Generate an APNs Auth Key (
.p8) and note the Key ID and Team ID. - Enable Push Notifications plus Background Modes → Remote notifications on the bundle ID.
3. Local configuration
- Update
src/utils/AppConstants.tsxwithappId,authKey,region,fcmProviderId, andapnProviderId. - Keep
app.jsonname consistent with your bundle ID / applicationId.
3.1 Dependencies snapshot (from Sample App)
4. Android setup
Placegoogle-services.json in android/app; then follow the steps below.
4.1 Configure Firebase with Android credentials
To allow Firebase on Android to use the credentials, thegoogle-services plugin must be enabled on the project. This requires modification to two files in the Android directory.
First, add the google-services plugin as a dependency inside of your /android/build.gradle file:
/android/app/build.gradle file:
4.2 Configure required permissions in AndroidManifest.xml as shown.
POST_NOTIFICATIONS on Android 13+).
4.3 Register FCM token with CometChat
Inside your main app file where you initialize CometChat, add the below code snippet after the user has logged in successfully. Initilize and register the FCM token for Android as shown:4.4 Unregister FCM token on logout
Typically, push token unregistration should occur prior to user logout, using theCometChat.logout() method.
For token unregistration, use the CometChatNotifications.unregisterPushToken() method provided by the SDKs.
5. iOS setup
5.1 Project Setup
Enable Push Notifications and Background Modes (Remote notifications) in Xcode.
5.2 Install dependencies:
Install the required packages for iOS push notifications:5.3 AppDelegate.swift modifications:
Add imports at the top:UNUserNotificationCenterDelegate to the AppDelegate class declaration:
didFinishLaunchingWithOptions method:
Podfile to avoid framework linkage issues:
5.4 App.tsx modifications:
Import CometChatNotifications:6. Handling notification taps and navigation
To handle notification taps and navigate to the appropriate chat screen, you need to set up handlers for both foreground and background notifications. :TODO: Add code snippets and explanation for setting up Notifee handlers and navigation logic.7. Testing checklist
- Android: install on device, grant POST_NOTIFICATIONS; log in and verify FCM token registration success.
- Send a message from another user:
- Foreground: Notifee banner shows unless that chat is open.
- Background/terminated: tap opens the correct conversation; Notifee background handler runs.
- iOS: verify APNs device token register; tap push from killed app opens the right chat; remote notifications finish handler is called.
- Rotate tokens (reinstall or revoke) and confirm
onTokenRefreshre-registers.
8. Troubleshooting
| Symptom | Quick checks |
|---|---|
| No pushes | Confirm google-services.json location, package/bundle IDs match Firebase/Apple, Push extension enabled with correct provider IDs, permissions granted. |
| Token registration fails | Ensure registration runs after login, provider IDs are set, and registerDeviceForRemoteMessages() is called (Android). |