Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we remotely dismiss a Push Notification?

My app daily broadcasts a Push Notification (PN) to all users which becomes irrelevant after 4 hours. Is there any way I can remove that notification on every user's notification centre that has not tapped it within those 4 hours?

I used to think this is not possible yet, but became hopeful after seeing the Google's Hangout app behaviour - It sends PN to Mac & iOS... and if I read the message on Mac, it automatically immediately removes it from iOS' Notification Center.

I did extensive research on google, surprisingly found nothing on this - just one question here which has been duly closed!

like image 446
BufferStack Avatar asked May 06 '14 08:05

BufferStack


People also ask

How do you dismiss a notification?

To dismiss a notification, touch it and swipe left or right. Tap the dismiss icon to dismiss all notifications. On newer versions of Android, you can manage some notifications from the lock screen. Double-tap a notification to open the app or swipe left or right to dismiss the notification.

What is opposite of push notification?

Push notifications are a type of technology for sending data to phones (pushing). An example would be an SMS message. See also WAP, Push email, etc. The opposite of this technology is usually referred to as "polling" where the phone will periodically ask a server for new information or content.

Can push notifications be intercepted?

Every push notification is impossible to intercept, even if there's malware present on user's device. To explore full advantages of Secure Push Messaging, request a demo.

What is remote push notification?

Overview. Use remote notifications (also known as push notifications) to push small amounts of data to devices that use your app, even when your app isn't running. Apps use notifications to provide important information to users. For example, a messaging service sends remote notifications when new messages arrive.


1 Answers

The trick is to make your app support background fetching and handle the push notification when you app is in the background.

Then in the application:didReceiveRemoteNotification:fetchCompletionHandler: set the application badge to 0 so that all you push notification are removed from the notification center.

Send a special push notification where there is not data displayed to user but does contain a an command to reset the push notification state.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {

  if([[userInfo objectForKey:@"reset"] boolValue]){
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
  }

}
like image 63
rckoenes Avatar answered Sep 22 '22 09:09

rckoenes