This is a sample app of integrating @appier/react-native-sdk with react-native-firebase. Please read the official document before getting start.
- Obtain the AIQUA app ID from the AIQUA dashboard. This will be used as
appIdin the following instructions. - A Firebase project.
- Obtain the iOS app group ID. Check here to learn more. This will be used as
appGroupin the following instructions.
To run on your own enviroment and test the funtionality by yourself, you need to follow the steps below.
-
Android:
- Register a new Android App with the package name
com.rntestin your FCM project. - Download the
google-services.jsonfrom your FCM console and put it intoandroid/app.
- Register a new Android App with the package name
-
iOS:
- Search and replace all the bundle identifier of
com.appier.rntestwith your own. - Search and replace all the
appGroupofgroup.com.appier.rntest.notificationwith your own. - Download the
GoogleService-info.plistfrom your FCM console and put it intoios/AppierRNExample.
- Search and replace all the bundle identifier of
-
React Native:
- Provide your information in
app.jsonas indicated below. All fields need to be required for working on both Android and iOS.
{ "name": "AppierRNExample", "displayName": "AppierRNExample", "appier": { "appId": "<appId>", "ios": { "appGroup": "<group.com.appier.rntest.notification>", "isDev": true }, "fcm": { "senderId": "<FCM senderId>", "serverKey": "<Cloud Messaging API (Legacy) server key>" } } }- Change
<appId>,<group.com.appier.rntest.notification>,<FCM senderId>and<Cloud Messaging API (Legacy) server key>to your own. - You can find both your
FCM senderIdandCloud Messaging API (Legacy) server keyin the FCM console -> Project settings -> Cloud Messaging Tab.
- Provide your information in
-
Android:
yarn && npx react-native run-android -
iOS:
yarn && cd ios && pod install cd .. && npx react-native run-ios
This sample app support FCM legacy HTTP API to send test notifications. To enable push notifications, please fill out the fcm object in the JSON file app.json with the appropriate values for your Firebase Cloud Messaging configuration as described above.
Check the following if you are unable to receive push notifications:
- The device is connected to the network.
- You can obtain an FCM token.
- GoogleService-info.plist (for iOS) or google-services.json (for Android) is located in the correct path.
- Push notification permission has been granted.