Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle APNS Remote Notifications while in Background

I have implemented all recommended methods in AppDelegate to get working Remote Notifications service.

I can accept them while running, while launching and while turned off.

But there is an issue, since I can't work with many received notifications while in background. I can work only with latest notification.

What is recommended manual to do that? How can I got all notifications received while in background? Is it only solvable via manual call to my service provider (sender of apns data)?

like image 899
Marek Sebera Avatar asked Sep 29 '11 15:09

Marek Sebera


2 Answers

With all the projects I've worked on there hasn't been a way to locally store this information if the push notification is dismissed. In all those cases we used a small file on the server that the app would connect to and pull when it became active again. There was also some place in the app where the user could see all their notifications which, again, were stored on the server for quick retrieval.

With the way I understand push notifications to be setup, if the notification is dismissed the system discards it. It'll perform anything it's supposed to do (such as update the badge number and play the correct sound) but any additional information specific to that notification is lost.

like image 177
Thomas Hajcak Avatar answered Nov 15 '22 22:11

Thomas Hajcak


Not sure if this helps, but if you just want to know how many notifications you have missed while you were in background. You can create a variable which contains notification number and store this in the app every time you handle notification. When you come out of background and receive a new notification you can subtract the new number with the stored number to find out the number of missed notifications. I don't think there is a way where iOS can give you complete data associated with all the notification device have received while the app was in background.

like image 44
Rahul Choudhary Avatar answered Nov 16 '22 00:11

Rahul Choudhary