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?
You can add "badge" option to notification payload.
ref: https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.