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:
- application running in foreground , receives push notification.
- user doesn't enter app badge visible.
- 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
Post a Comment