Reputation: 5299
When application in background that time badge count not set last 5 days before is working properly.
Badge count every time increase by php backend ex. Current badge = 10 then after second push get then badge = 11
I am using bellow payload formate.
If any change in bellow formate then help me i read also refer Apple Push Notification Service.
push notification payload is a JSON payload:
{
"aps": {
"badge": 10,
"alert": "Hello world!",
"sound": "cat.caf"
}
}
registerUserNotificationSettings
if (ios8)
{
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
Upvotes: 4
Views: 1271
Reputation: 3896
According to the description of payload keys from Apple documentation, the value associated with the key badge must be a number, so you can't increment the badge value from the payload (otherwise you couldn't differentiate a incrementation or a badge set to 1).
You can save the badge value server side and increment in on the server, so it will looks like an incrementation for the user.
Upvotes: 2