I've been implementing the push service to my application, and I've been thinking about the application's badge. My app is a mail app (sorta) and I want to notify the user via push for new messages added to the inbox, I want the badge = number of new messages in the inbox.
I thought of doing it server sided (provider) checking for new messages and sending the number as the badge.
The question is: Is there a way to auto-increment the application's badge, without having to calculate the badge value server sided and afterwards sending it as a part of the push payload to the APSN?
Maybe there's a way to send in JSON badge field some variable like "++" or something like that. Any hack for that? Or do I need to go with the counting system server-sided??
Open Settings again and see if the option to enable Badges appears. Restarting your iPhone often fixes issues like this.
Starting with 8.0 (API level 26), notification badges (also known as notification dots) appear on a launcher icon when the associated app has an active notification. Users can long-press on the app icon to reveal the notifications (alongside any app shortcuts), as shown in figure 1.
1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges. 4 Select Show with number.
Nope, you'll have to track this on the server side. If you don't include any value for badge, it will get removed completely.
Of course though this is only if the user receives the notification and the app isn't running/they choose not to launch it. If the user launches the app or already had it running you can do whatever you want in regards to incrementing.
UPDATE March 2014: See comments for a possible update. I haven't done pushes in several years so haven't been able to verify this myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With