ios - Informing APNS about badge count -


i've implmented simple server pushing notifications ios devices , can't imagine how handle badges. i've read topics , know it's not solution handle them manually on device, it's server job...

everything clear still don't know , couldn't find anywhere how let server know there unreaded notifications on device? mean in uiapplicationdelegate info beeing read?

just guys imagine problem:

  1. application running in foreground , receives push notification.
  2. user doesn't enter app badge visible.
  3. after 5 mins comes notification (again badge value set 1 in payload).

and scenario happen many times apns still pushing payload same value badge.

the number of badges can obtained method

[application applicationiconbadgenumber] 

inside application:didfinishlaunchingwithoptions: method.

hope helps!

update:

after clarifying question, i'll update answer accepted solution. future searchers:

what if backend increase badge every time when notification sent? example, send first notification badge count 1. it's time send notification - send badge count 2. user opens app , makes api call backend - , zero-out badge count, , next notification send badge count 1. if app get's notification in foreground, makes api call , zero-out badge count well.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -