Objective-c – Push-Notification Badge auto increment

iphoneiphone-sdk-3.0objective cpush-notification

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??

Best Answer

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.

Related Topic