App icon badge - Firebase push notification /FCM - Flutter

Viewed 7917

I want to show notification counter on my app icon. I need to do it for both iOS and Android. Also counter must update when App is killed(not running) or when running in background. I am using firebase push notifications.

If I consider using common counter then I can use FirebaseMessaging.configure onMessage event to decrease the counter value, but how to increase the value of the same counter (how will I know that notification is received).

flutter_app_badger 1.1.2 description showing increasing and decreasing counter value on button press, how can I listen to notification and handle counter?

Below is my Message Payload

    var tokens = [];
var payload = {
    "notification": {
        "title": "Contest Won! " + contestActivityFeedData.contestname,
        "body": "You Have Won " + contestActivityFeedData.amount,
        "click_action": "FLUTTER_NOTIFICATION_CLICK",
    },
    "data": {
        "contestid": contestActivityFeedData.contestid,
        "contestname": contestActivityFeedData.contestname,
        "notificationtype": 'contest_won'
    },
}
admin.messaging().sendToDevice(tokens, payload);

Any article/video/plugin for this?

This is what i am trying to achieve

1 Answers
Related