Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I programmatically clear my app's notifications from the iOS 5 Notification Center?

Tags:

ios5

I would like to remove old notifications that my app has made from the iOS 5 Notification Center. Can I do this? If so, how?

like image 836
Will Avatar asked Oct 14 '11 21:10

Will


People also ask

How do I clear all app notifications on iPhone?

When notifications appear on your iPhone, do any of the following: Handle a notification you receive while using another app: Pull it down to view it, then swipe up to dismiss it. Clear notifications: Swipe left on a notification or group of notifications, then tap Clear or Clear All.

How do I clear all app notifications?

Use notifications. To clear one notification, swipe it left or right. To clear all notifications, scroll to the bottom of your notifications and tap Clear all.

What is push notification how it works?

Push notifications look like SMS text messages and mobile alerts, but they only reach users who have installed your app. All the mobile platforms – iOS, Android, Fire OS, Windows and BlackBerry – have their own services for supporting push.


1 Answers

To remove notifications from the Notification Center simply set your icon badge number to zero.

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; 

This only works if the number changes, so if your app doesn't use the badge number you have to first set, then reset it.

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1]; [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; 
like image 52
voidStern Avatar answered Oct 13 '22 01:10

voidStern