Search code examples
iospush-notificationibm-cloudbadge

New message badge on iOS app icon


I need to display something like this to show there are new notifications for my app.

enter image description here

But I don't want to keep tracking the number of new notifications. Just a badge to show there are new ones, should be enough. So ideally, the badge is a red circle with "...".

How would I go about achieving this?


Solution

  • Since I know you are using the IBM Push Notifications service on Bluemix there is an easy way to accomplish this. When sending a push notification using the IBM Push Notification service you can indicate a badge value as part of the optional payload:

    iOS Badge - For iOS devices, the number to display as the badge of the app icon. If this property is absent, the badge is not changed. To remove the badge, set the value of this property to 0.

    If you are sending the push notification through the Bluemix Push Dashboard, you can simply enter the badge value you want to be displayed once the notification is successfully received:

    BadgeIconOption

    If you are sending the push notification via Node.js, REST, etc you can add the badge value as an option parameter. Please take a look at the model provided in our REST API documentation to see the correct structure:

    https://mobile.ng.bluemix.net/imfpushrestapidocs/#!/messages/post_apps_applicationId_messages

    apns {
    badge (integer, optional): The number to display as the badge of the application icon,
    .
    .
    .
    }