Integration steps
Create a Firebase project in the firebase console
To start sending notifications from FCM, you’ll have to first create a firebase project. Create a firebase project and application in firebase console with your applications package name which you can find in MainApplication.java or AndroidManifest.xml.
Adding google-services.json to your project
You can get your Service Account JSON from Firebase Console Project Settings. Download google-services.json and add the file inside your android > app folder.
Adding Firebase dependencies and plugins
Add the below dependency inside projects build.gradle inside dependenciesAdd the below plugin inside the app build.gradleAdd the below dependency inside apps build.gradle inside dependencies
Implementing push
Push feature can be implemented in two ways:
Token Generation and Notification handled By SDK [Recommended]
Token Generation and Notification handled By SDK [Recommended]
You may use this option if all of your android push notifications are to be handled via SuprSend SDK. We recommend you use this method as it is just a single-step process to just register the service in your application manifest and everything else will be ready.
Token Generation and Notification handled By Your Application
Token Generation and Notification handled By Your Application
Once you get a token from Firebase you can pass the token by using the below codeWhen you get a push notification you will get a payload and it can be passed to the method provided by Suprsend React Native SDK and the notification displaying part will be handled by SDK.
If notification payload contains key supr_send_n_pl then simply consider this as payload sent from suprsend and pass the payload to suprsend SDK by:if (payload?.data?.supr_send_n_pl) { suprsend.showNotification(payload.data.supr_send_n_pl); }