Start a conversation

How can I increment the badge counter each time a push notification is received (iOS/REST API)?

Unfortunately, the iOS device is not able to increment the badge counter automatically each time a new push message is received.
But in order to manage the badge counter, you need to send a push notification with the proper badge value.

Please refer to our documentation paragraph: https://docs.quickblox.com/docs/ios-push-notifications#create-universal-apns-certificate


You need to create pushParameters dictionary of [String: String] type.
Swift:

var pushParameters = [String : String]()

Objective – C: 

NSMutableDictionary *pushParameters = [NSMutableDictionary  dictionary];


After that, you will need to assign the required value to the "ios_badge" key in the pushParameters dictionary. 

Swift:

pushParameters["ios_badge"] = "2"

Objective – C:

pushParameters[@"ios_badge"] = @"2";


Do not hesitate to check our documentation for more details about sending push notifications:
https://docs.quickblox.com/docs/ios-push-notifications#send-push-notifications

  There is also a possibility to send push and manage badge value from the Admin panel. In order to do that you need to access your application admin panel and manage the notification badges.
You need to navigate to Dashboard YOUR_APP > Chat > Offline messaging directory to locate offline messaging settings.

There is the "Badge counter" option where you can set the badge info to include the counter details into your push message. It is useful to include unread counter - the number of unread messages a user has.

Please check our documentation page regarding this matter:
https://docs.quickblox.com/docs/ios-chat-advanced#offline-messaging

Let us know if you have any questions or require any help! You can do that via the helpdesk.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Maksym Pidhorbunskyi

  2. Posted
  3. Updated

Comments