Onesignal-ios-sdk: Badge Count Does Not Show On Icon

Created on 10 Mar 2016  路  7Comments  路  Source: OneSignal/OneSignal-iOS-SDK

I am new to adding Swift code for push notifications. I did the following and still have no badge count displaying when I send a push notification. I set the applicationIconBadgeNumber in the fetchCompletionHandler function.
Has anyone else had this issue and resolved it? Or is there something else that needs done for badge counts to work using the OneSignal push service?

Thanks so much!

Most helpful comment

Is there a way to increment badge number when using OneSignal.postNotification ?

All 7 comments

The badge count is handled for you by OneSignal, no need to add your own code to set it. Just set or increase the badge count by the value you want on our dashboard or REST API.

Badge icons are only set when a push notification is received while the app is not in focus or closed.

Let us know if this isn't what you're seeing.

Thanks.

Thank you so much for the reply. This was my ignorance. I was thinking it was all set in the code.

Is there a way to increment badge number when using OneSignal.postNotification ?

Hi,

[OneSignal postNotification:@{@"contents":@{@"en":text}, @"include_player_ids":oneSignalIds,@"content_available":@true,@"ios_badgeType":@"Increase",@"ios_badgeCount":@1}];

I have set ios_badgeType and ios_badgeCount both during sending of Notification so do i need to set anything for receiver side?

when i got notification the application badge doesn't auto incremented.

Keep in mind that the badge count is only incremented when the app isn't open. So if the notification was received while the app was open, the badge count won't increase.

You should not need to do anything on the client side (iOS)

Hi Thanks for your reply,

my badge count was 54. and i removed my app from background. when i got notification the sender send
[OneSignal postNotification:@{@"contents":@{@"en":text}, @"include_player_ids":oneSignalIds,@"content_available":@true,@"ios_badgeType":@"Increase",@"ios_badgeCount":@1}];

but when notification received it starts with 1. why it is not starting with 54?

My simple question is

let notificationReceivedBlock: OSHandleNotificationReceivedBlock = { notification in

is called when application is not in background? if not then which method is called when our application is not in background and we received notification.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chmiiller picture chmiiller  路  6Comments

arthurdapaz picture arthurdapaz  路  5Comments

ogres picture ogres  路  3Comments

appcelerate picture appcelerate  路  3Comments

torben-erz picture torben-erz  路  3Comments