The CometChat React Native Enhanced Push Notifications (Beta) Sample App is capable of handling push notifications for one-on-one (private), group messaging, and even call notifications. This sample app enables users to send and receive text messages, make and receive calls, and effectively displays push notifications for these interactions.
In our sample app:
- Firebase Cloud Messaging (FCM) is used for displaying push notifications in Android
- Apple Push Notification (APN) is used for displaying push notifications in iOS.
Note
If you use Push Notifications (Extension), please refer to our React Native Push Notifications (Extension) Sample app for guidance.
- Login to the CometChat Dashboard.
- Select an existing app or create a new one.
- Click on the Notifications section from the menu on the left.
- Enable Push Notifications by clicking on the toggle bar and configure the push notifications.
- Add credentials for FCM or APNs.
- Clone this repository.
- Run the following commands:
npm i -f
cd ios
pod install
cd ..
- If you're using Firebase Cloud Messaging (FCM), place the
google-services.json
&GoogleService-Info.plist
files in the correct location as per FCM's documentation. - Add your app credentials like
APP_ID
,REGION
, andAUTH_KEY
in thesrc/CONSTS.ts
file. - Also store the
FCM_PROVIDER_ID
(in case you're using FCM) orAPNS_PROVIDER_ID
(in case you're using APNs) insrc/CONSTS.ts
. - Run the sample app
npm run android # To run the Android app
npm run ios # To run the iOS app
- Once the app is running on your device or emulator, login with a user.(The iOS app has to be run on a device. The Android app can run on emulator or device.)
- Allow the permission to display push notifications.
- Put the app in the background or terminate it.
- Send a message or call to the logged in user from another device.
- You should see a push notification for a message and call notification for a call.
- Tap on the notification to open the Sample app for message.
- Tap on accept/decline on call notification to initiate or decline call.
For issues running the project or integrating with our UI Kits, consult our documentation or create a support ticket or seek real-time support via the CometChat Dashboard.