I'm building an app with the Corona SDK which has a QuickBlox back end. I have one final technical challenge - how can I get the badge counter to increment each time a push notification is received? I am using the REST API to send the messages.
2 Answers
1
votes
To manage badge counter in Push Notification you should send Push Notification with proper badge value. iOS device doesn't increment it automatically each time you received new push message
To send push from iOS device with particular badge counter you should use this code:
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
NSMutableDictionary *aps = [NSMutableDictionary dictionary];
[aps setObject:@"default" forKey:QBMPushMessageSoundKey];
[aps setObject:@"This is Push Notification, baby!" forKey:QBMPushMessageAlertKey];
[aps setObject:@"5" forKey:QBMPushMessageBadgeKey];
[payload setObject:aps forKey:QBMPushMessageApsKey];
QBMPushMessage *message = [[QBMPushMessage alloc] initWithPayload:payload];
// Send push
[QBMessages TSendPush:message toUsers:@"218650" delegate:self];
You will receive push message with badge value = 5
Also you can send push from Admin panel and manage badge value as well https://www.evernote.com/shard/s216/sh/7e53a5e3-c24b-4ae9-b4c4-855dd4f41370/b404dcb788992fb1a8dabe1bf0fbcc0f