Firebase Push (FCM)
A guide to integrate FCM push notifications in android applications using SuprSend
Integration Steps
Create Firebase project in firebase console
To start sending notifications from FCM, you’ll have to first create a firebase project. Create 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
You can get your Service Account JSON by following these instructions. Download google-services.json and add the file inside your android>app folder.
Adding Firebase dependencies and plugins
Add below dependency inside projects build.gradle inside dependencies
Add below plugin inside apps build.gradle
Add below dependency inside apps build.gradle inside dependencies
Implementing push
Push feature can be implemented in two ways:
Sending the FCM token to SuprSend
Asking for permission -Android 13(API-33)
If androidx dependency is not present then you will have to add the below dependency in your app dependencies
How to identify if notification is sent by SuprSend?
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);
}