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

2

8

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;
};
Rosalynrosalynd answered 18/11, 2013 at 11:34 Comment(1)
Ok, someone just asked why are we setting a badge, which is a valid question. It wasn't our intention too do that, but it seems we have been running our testing with badge = 2. We will repeat the testing without the badge. I'll update once we have completed that test, although interested to hear any other comments in the meantime.Rosalynrosalynd
C
4

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.

Coherence answered 18/11, 2013 at 17:20 Comment(4)
So, it is not possible to send a (silent) push notification to an app, an have it react to it, if the app is in the background?Techno
if you want silent push when app is in the background, you can set "sound" element empty in the notification payload, or add a "silent" sound file and use it:developer.apple.com/library/ios/documentation/…Coherence
it appears to me that question is about iOS7 silent push. App should receive it regardless of the state.Boulanger
You can send a silent push notification, and have the app react to it even if it has been backgrounded and is lying dormant. You will get a 30 second window to react. For this you need to enable "remote-notification", and use the "content-available" flag on your notification. Be aware that iOS 7.0 has many bugs with fetching that you may need to work around, and also if the user has terminated your app in the task switcher (or never ran it) then it may not work.Auraaural
P
0

I can imagine three causes for the behavior you are seeing:

  1. Your app has crashed while you were not looking,
  2. The user has force-closed your app,
  3. The system has rebooted.

These are the only cases your app will no longer be launched in order to receive the background notification. Now you need to debug which one of those applies.

Pitarys answered 24/8, 2017 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.