Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS clear push notifications

I notice that for apps like Google Hangout, Facebook etc. when I get a push notification for any event (people writing on my wall, etc.), if I view the event on my desktop, it will clear the push notification (which I have not cleared myself or opened the app for) on my iPhone.

How can I implement the same?

Right now i'm using this app for implementing my push's.

I customized the above, but the implementation is similar. Do I need to send any special data to the phone to clear all notifications from my app?

like image 976
KVISH Avatar asked Jan 14 '14 21:01

KVISH


People also ask

How do I clear all notification badges on iPhone?

Go to Settings and open Notifications. Scroll down and tap on Messages. To disable notifications altogether, toggle off Allow Notifications. To remove badges, turn off the toggle next to Badges.

How do I clear notifications that won't go away?

To remove a persistent notification on Android as fast as possible, first, press-and-hold on it. Alternatively, swipe the notification left or right to reveal a gear icon on either side, and then tap on it. The notification expands. Tap on “Turn off notifications” at the bottom.


1 Answers

I did same in my application that read notifications don't remain in Application. Buts its not how you think it is.

i Saved Remote Notification in method didReceiveRemoteNotification: in DataBase (Coredata). Everytime i was in NotificationViewController i retrieved from DataBase (Coredata) and when i want to clear them i-e on Reading , deleted that particular Notification form DB.

thats how you should do it.

OR https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW1 Apple says in iOS 7 user can send "silent" push notifications—that is, notifications that do not display alerts or otherwise disturb the user. By receieving this type "silent" in method application:didReceiveRemoteNotification: do this [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0]; [[UIApplication sharedApplication] cancelAllLocalNotifications];

like image 185
Zeeshan Avatar answered Nov 10 '22 13:11

Zeeshan