Search code examples
ioscordovaapple-push-notificationspushwoosh

How can I update iOS badges with pushWoosh?


I am using PushWoosh phonegap plugin; I have pushwoosh set up and can send push notifications. I can also update the iOS badge number when sending push notification from within the notification request payload. But how can I update the badge number without sending push notification?

I use setBadge method of pushWoosh API, and get 200 OK response, but the badge number doesn't update.

What's the right way of updating the badge number with pushWoosh API?


Solution

  • setBadge in Pushwoosh API lets Pushwoosh know the current badge number. It is used internally. This way when you send incremental badge (ex: "+1") it will know what the value of the badge should be.

    There are two ways of updating badge:

    1. In the app code (probably this is not what you are looking for): use setApplicationIconBadgeNumber method in the Phonegap Plugin.

    2. Via push notification. However I assume you don't want it to be full-blown push notification with text. At the moment this is available only via API, but by the end of the week it will be possible to do in the Control Panel as well. The trick is: do not put any content (text) in the push notification. This way it will only update the badge and will not display the push alert. You also combine this with the "silent push", this way notification will be completely silent.

    Pushwoosh team.