Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the badge number when local notification is canceled

I'm developing a reminder app. I'm using local notification. It is working fine. But a badge number is always showing on top of my app's icon. How can I remove the badge number after firing the local notification? When I put [UIApplication sharedApplication].applicationIconBadgeNumber = 0; in did finish launching, the badge number is completely removed.

like image 920
Senorina Avatar asked Aug 20 '11 05:08

Senorina


2 Answers

I guess that you are trying to remove the badgeNumber from the badge icon and show only an empty(without any number) badge icon. You can not just remove the badge number alone from the badge icon. If you set applicationIconBadgeNumber to 0, the badge icon itself will be removed from the application icon.

If the badge to be shown then there should be a number, not a 0. 0 is inteneted to remove the badge icon.

like image 183
EmptyStack Avatar answered Oct 17 '22 01:10

EmptyStack


Whenever The Notification Fired In App delegate didReceiveLocalNotification Method Fired You Can Decrease The Count By One And Add One When You Add New Notification.

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

    [UIApplication sharedApplication].applicationIconBadgeNumber=application.applicationIconBadgeNumber-1;
}

Cheers

like image 20
Srinivas Avatar answered Oct 16 '22 23:10

Srinivas