We have a requirement in our iOS5/6 app to remove the badge number from our app icon, but leave the notification text in the notification center. Setting the badge number to 0 clears out the notification text as well.
Our potential solution is to set the badge number to -1, which seems to do exactly what we are looking for. Does anyone else have any experience with doing this?
When you open the app and set the application badge to 0, all the notifications of the notification center are cleared.
This works as expected in iOS 5 and 6.0. We are able to remove the badge icon, but not the notification text by setting the badge number to -1.
Related
I am developing an app in which I have implemented a small turn based game using game centre. I have facing a problem and problem is when I have start the game and invite a friend then the notification banner with appropriate message is display on friend device but when he play the game and give turn to me and when my app is in background mode then only the badge is display but notification banner is not display but if I have remove the app from background then notification banner appears correctly. This process is running correctly with iOS 7 & 8 but not with iOS 9. Please suggest me any idea to solve this.
Thanks in advance!
My app uses Local Notifications. There are situations when more than one notification is scheduled and at some point displayed. When notifications are displayed badge number is updated automatically. When user clicks on one of the notifications I manually decrease badge number and cancel the notification.
The problem starts when user manually dismisses notification from Notification Center. The badge number is not updated. There are situations when there are no notifications displayed in Notification Center and badge shows a number. User is not able to clear the badge.
Setting the badge number to 0 (instead of decreasing it) after clicking on one of the notifications is not an option because it causes all notifications to disappear from Notification Center.
Is there a good way to resolve this issue?
Is there a good way to resolve this issue?
No.
Your app isn't notified when a user dismisses the local notification. Only push notifications can set the badge number when your app isn't running.
The badge is intended to represent the internal state of some data in your app that you control. There is no way to make it always match the number of items in the user's notification center. This is also why you get no notification if the user cancels your local notification.
I am a bit (a lot) confused about the Notification Center and the app badge counter. I have designed an iOS to-do app which uses local notifications to alert users of a scheduled reminder (which they set in the app) . The app also uses the icon batch counter to display the # of tasks due "today".
At the time of a set reminder notifications correctly show up in Notification Center. However, once the app has been opened the notifications are cleared from Notification Center. The idea is that the notifications remain available in Notification Center until the user clears them.
I have discussed this with my developer and he states that notifications can only be saved in NC when we do not use the icon batch counter. This seems very illogical to me since the icon batch counter shows the # of tasks due "today" and the notifications shown in Notification Center are alerts set by the user.
Hope you guys can help here.... Thanks!
application can set its own badge (counter) independent of the notification scheduled. so u can surely set whatever counter you want to show the today's task by:
NSUInteger tasksCount = 10;
[UIApplication sharedApplication].applicationIconBadgeNumber = tasksCount;
talking about the notifications to show in NF bar, it is configurable by user in Device's Native: Settings-> Notifications-> so you cannot force the user to show all notifications in NF bar (lets say 50 for the day) if user has configured for only 5.
Coming back to your concern, when the app is launched, Notifications from NF bar are not automatically wiped off. you have to write the CODE to remove them from inside the app.
[[UIApplication sharedApplication] cancelAllLocalNotifications];
OR
[[UIApplication sharedApplication] cancelLocalNotification:<notification object>];
I have basic push notifications sending to my application. I was wondering if there was a way to clear the notifications in the notification center when the app is opened?
There You may use Ti.UI.iPhone.appBadge = 0; to reset the appBagde in the device. From 3.x, Appcelerator has added a new functionality to reset the badge on Appcelerator server.
Cloud.PushNotifications.setBadge() method allows the user to set the badge and Cloud.PushNotifications.resetBadge() will reset the badge in the notification center.
I have implemented UILocalNotification for iOS 6 but every time the notification is launched, it is displayed as a banner. Is there way I can default it to be an alert (like previous iOS 4)?
Thanks in advance everyone!
This is a setting which you cannot set programmatically. All apps that use notifications have a setting in the Settings app which you can choose from alert, banner, or none.
So bottom line, it is up to the user to select the type of notification.