how to remove badge notification symbol from app icon in iPhone - iphone

I am facing a problem with removing the badge number which always shows a red "1" on app icon notification symbol where there is no notification pending.
How can I solve it?

Use the below in applicationDidBecomeActive, some any methods in app life cycle..
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
When it is set to zero it should not show any badges.

Related

Remove LocalNotification Badge Number from launcher icon

I am trying to add a feature in app in which whenever i made a note, it will Call a UILocalNotification after few days (Hardcoded). Now, on launcher Icons i can see a red badge with marker "1". How can I remove this badge?
Best Regards
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
Add that line in whatever code handles the user's interaction with the local notification. If you want the badge to be cleared when the local notification fires, you can't (because setting the notification's applicationIconBadgeNumber property to 0 would simply mean "don't change the existing badge.")

Reducing badge number with Push notifications

Hi in my application when i receive push notification from server my application badge get incremented by one.and when i open app and close it did not get reduce.so my question is how to reduce badge icon on application icon when user see the notification
You can set it to any value you like. Setting it to 0 removes the badge.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
I had this same issue, so I thought, "Why not just GET the badge number?" Then, you can do whatever you wish with it.
If you are in your AppDelegate.m file, you could use this in your application: didFinishLaunchingWithOptions: method:
int badgeNumber = [application applicationIconBadgeNumber] -1;
[application setApplicationIconBadgeNumber:badgeNumber];
This will reduce the icon badge number by one. However, be mindful that your user may have multiple notifications from your application that are still not yet viewed. Thus, you should probably set this inside of a particular method that will handle the pushes. Or, depending how your app is set up, just set the badge icon number to 0.
Hope this helps.

iOS: App Icon Badge Will Not Go Away

I've added a Local Notification into my app, but for some reason, the app installs with a "1" icon. Opening it and closing it doesn't seem to make it go away. I typed application.applicationIconBadgeNumber = 0; into the app delegate, and have localNotif.applicationIconBadgeNumber = 0; in my notification area. Does anyone know what I'm missing? Thank you!
This should work. Place it in applicationDidFinishLaunching in your app delegate file (or anywhere else, but that's a good place to test).
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

How to give notification on icon

How can I add some kind of notification on an application icon displayed on the springboard?
Like it can be seen on messenger icons showing a number with red color on it once new messages are received.
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;

change Badge and push notification in iPhone SDK

I tried the push notification tutorial . It's working fine but problem is badge. When I click on the view, app is appear and the close it. it still red badge in app icon. How to remove it ?
Another question is
when I click the view, it will appear home screen. I want to show other view when coming from push notification.
This will reset the application badge number. If you set that value to zero, it will hide the badge.
[UIApplication sharedApplication].applicationIconBadgeNumber = iCount;
To handle your push notification with a separate view, you need to handle the following message in your application delegate:
- (void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo
You can access the userInfo dictionary to get additional information about the push notification that resulted in the message callback.