IPhone: automatically increments the icon counter

Possible duplicate:
Automatically increase the Push-Notification icon .

I applied Push Notification to my iPhone application. Whenever I receive a message, I want to increase the value of the icon by one, so I don’t need to pass it in the Push Notification payload. Is it possible?

From here I found out that I need to manage this from the server side, so what is the only way? Did I need to save the previous value in the database and get the last value when sending the next message? Doesn't Apple support this automatically, like incrementing application.applicationIconBadgeNumber whenever a transfer notification is received.

The problem with managing the icon number on the server side is that if the user had already seen the previous Push Notification message, you would send the wrong icon number!

+3
source share
1 answer

It's not a problem. The client simply needs to tell the server what messages it saw. Everyone else does it, so just learn to do it and do it.

EDIT: You can set the icon counter using:

[UIApplication sharedApplication].applicationIconBadgeNumber = badgeCount;

Each time you do this, you must send badgeCountto the server so that the server knows the current account.

+8
source

All Articles