Setting badge number to 0 removes all notifications

#1

On iOS, when a user taps on a notification from the Notifications screen, the app is foregrounded and I decrement the current badge number:

Notifications.getBadgeNumberAsync().then(badgeNumber => {
  if (badgeNumber !== 0) {
    Notifications.setBadgeNumberAsync(badgeNumber - 1);
  }
});

If the number of notifications doesn’t match the badge number (due to older notifications for instance) and I set the badge number to 0, all notifications are removed from the Notifications screen. Is this intentional and is there away around it that does not involve synchronizing the amount of notifications with the badge number?

1 Like
#2

This is how iOS behaves. You might be able to set the badge number to -1 but this seems like undocumented behavior. https://forums.developer.apple.com/thread/7598

1 Like