How can I auto increment the iOS notification badge with Firebase Cloud Messaging? Is it possible to do something like +1
or ++
?
Asked
Active
Viewed 1.9k times
16

tomwassing
- 925
- 1
- 10
- 30
-
2https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support for the documentation scroll down to **Table 2a. iOS — keys for notification messages** : badge Optional, string Indicates the badge on the client app home icon. – Feb 12 '17 at 22:39
-
7Note: this question shouldn't be marked as a duplicate. Firebase Cloud Messaging has a different API on top of APN so the answers to those other questions are not helpful and do not apply. – FrederickCook Dec 12 '17 at 20:51
-
2I just voted it for reopen as this is not a duplicate as Firebase Cloud Messaging has a different API. – TheTiger Feb 13 '19 at 05:16
-
This question should be reopened as the answers provided are not for the FCM – JotK. Feb 13 '19 at 05:22
1 Answers
6
You can set badge value in (notification payload). You can use your own server to send push notifications and control (increment) a badge value. There is no way to control badge number if you are sending a push notification directly from device to device with Firebase. The only way you can set a badge is when you are sure the destination device will receive only push notifications from one source device, and you can set a badge value on that source device.

bojanb89
- 346
- 3
- 8
-
How does this solution solve this problem https://stackoverflow.com/questions/70682661/flutter-how-to-update-notification-badge-when-sending-notification-in-terminat?noredirect=1#comment124959421_70682661 – busuu Jan 12 '22 at 18:14