Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does iOS stop delivering silent push notifications if the user ignores too many by not opening the app?

We're relatively new to iOS push notifications, and as always with Apple, I'm impressed by the elegance of the solution, but also slightly infuriated by what appears to be some opaque 'behind the scenes' management of the feature's behaviour.

My question is this: After successfully receiving approx. 10 separate silent push notifications at a rate of one per hour, no more were delivered to our test app until it was finally opened by our test user. Based on this it appears that iOS may stop delivering silent push notifications if it determines an app is not in use. Is this expected behaviour? Does anyone know any rough details about the heuristic used by Apple for this?

Details of the testing for those interested

FYI, our test set up is as follows:

  1. We have built a simple Notification test app (built for iOS7 using the application:didReceiveRemoteNotification:fetchCompletionHandler delegate method)
  2. For the duration of the test the app was kept in suspended state in the background on our test iPhone 5 (sometimes in the office on wifi, sometimes on 3G in and around London).
  3. We have a simple Ruby script using the Grocer gem (which seems very good incidentally) sending a silent push notification every hour to the app, via Apple's sandbox APNS gateway.
  4. When the app receives the notification it wakes up, writes a log and makes a simple request to our backend server, which also logs the event having occurred.

Results:

  1. Everything works exactly as expected for the first 10 hours. After this no more notifications are received by the app.

The notification format (manually copied out, excuse any errors):

aps = {
  badge = 2;
  "content-available" = 1;
};
like image 231
user2854097 Avatar asked Nov 18 '13 11:11

user2854097


1 Answers

I had do a lot test of my app's push function few months ago, some of my experiences here:

  1. Apple Push Notification doesn't care about if your app is in use or not.
  2. APNS is not 100% reliable, the most influential factor is network quality(your server to APN server,APN servere to your device).
  3. I have pushed 10,000 notifications to a iphone4s in 3 minutes, device received more than 95% notifications.So, 10 separate silent push notifications at a rate of one per hour has no pressure.

Now, have some discuss about your question:

First: Should realize that the first receiver of notifications is system,not your app.

If your app isn't in foreground, app's application:didReceiveRemoteNotification:fetchCompletionHandler will never be called until your app becomes to the foreground again. So, your " writes a log and makes a simple request to our backend server" action is not suitable to "logs the event having occurred".

I think there is not a good way to "logs all the event having occurred" unless your app is always in foreground.

BTW: when you are testing push,if device doesn't reveive notification quickly,you could change device's network (or turn off then turn on network),sometimes,the notification will come soon.

like image 183
Joiningss Avatar answered Sep 19 '22 21:09

Joiningss