Firebase Push (FCM)
This will guide you to integrate FCM push notifications in android flutter applications using SuprSend
Example integration project can be found here.
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 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
3.1. Add the below dependency inside projects build.gradle
inside dependencies
3.2. Add the below plugin inside the app build.gradle
3.3 Add the below dependency inside apps build.gradle
inside dependencies
Implementing push
Push feature can be implemented in two ways:
Targeting Android 13 (API-33)
In Android13 (API 33) or higher notification permission will be disabled by default so permission needs to be asked to enable notifications if you are targeting android 13 users. You can follow this doc to update to support Andriod 13(API 33), if not already supported. Please test the application as well as upgrading to API 33 may causes breaking changes.
Add POST_NOTIFICATIONS permission in AndroidManifest.xml if not present already.
From your code call the SDK method to show a notification permission popup
This method is asynchronous and returns permission values. To show permission popup we use flutter package permission_handler
This method is available from suprsend-flutter-sdk v2.0.0. Please update it if using lower versions
Once permission is granted users can be able to get push notifications.