- Home /
Resetting Notification App Icon Badge Number
I am trying to reset the application icon badge number for a notification in my game, but I do not know the correct way to do so. Is setting the applicationIconBadgeNumber of the notification to 0 a way? Because I tried that and the badge did not go away.
It is using LocalNotification. Here is how I display the notification:
LocalNotification notif = new LocalNotification();
notif.fireDate = energyRefillTime.Value;
notif.alertBody = "You have more lives!";
notif.alertAction = "The wait is over!";
notif.soundName = LocalNotification.defaultSoundName;
notif.applicationIconBadgeNumber = 1;
NotificationServices.ScheduleLocalNotification(notif);
Here is how I am trying to reset and clear the application icon badge number:
notif.applicationIconBadgeNumber = -1;
I have also tried:
NotificationServices.CancelAllNotifications();
NotificationServices.ClearAllNotifications();
Both have not worked.
Please help! Thank you in advance.
Answer by SyedUmair · Dec 30, 2014 at 08:00 AM
Ahh, though its an old thread. But still, if it may help someone:
void ResetAppBadgeIcon() { LocalNotification setCountNotif = new LocalNotification(); setCountNotif.applicationIconBadgeNumber = -1; setCountNotif.hasAction = false; NotificationServices.PresentLocalNotificationNow(setCountNotif); }
Works perfectly for me. :)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Register For Notification 0 Answers
Mobile notifications 0 Answers