The number of badges can be obtained from method
[application applicationIconBadgeNumber]
inside application:didFinishLaunchingWithOptions:
method.
Hope this helps!
UPDATE:
After clarifying the question, I'll update the answer with accepted solution. For future searchers:
what if the backend would increase the badge every time when the notification will be sent? for example, You send first notification with badge count 1. Then it's time to send another notification - you send it with badge count 2. Then user opens the app and makes API call to the backend - and you zero-out the badge count, and the next notification would be send with badge count 1. If app get's notification in foreground, it makes the api call immediately and you zero-out the badge count immediately as well.