APNS (Apple Push Notification Service) reliability

28,089

Solution 1

  1. APNS is based on Apple Servers, and Apple doesn't give any guarantee on successful message delivery.
  2. If the app is open (i.e. the user is using the app) while the notification arrives, iOS doesn't show a notification message, you need to handle it.
  3. Notification shows up only when the app is backgrounded or killed.
  4. Also implement feedback service on your server side; will help you get rid of old unwanted tokens (users who deleted the app or disabled notifications through settings).
  5. Don't send too many notifications to a device within a short span of time, because APNS caches only 1 message/device (if the device is offline). So it can deliver the message when the device comes online. Am not sure how long the message is cached though.

Or just implement Pusher... http://pusher.com

Solution 2

We're facing the same problem. As everybody said, APNS is a best effort service so you can't be sure every notification will be delivered, but what you can do is to be sure of which ones have been received. This is what we're about to do. We register in our backend each notification que ship and the mobile app reports back each notification it receives. Then we set a maximum time of waiting for a notification to be received, if we don't receive the report back we try again.

I hope it might be helpful to someone (even 2 years later)

Solution 3

It says it quite clearly in the Apple Docs that it is not 100% gauranteed and nor should it be used as so. Its sent with "best effort".

Share:
28,089
Faust V
Author by

Faust V

I'm a web developer apprentice, working for local small company. I have learned Java and other web-related technologies (PHP, MySQL, JavaScript etc) on my own. However, I was suddenly assigned to develop an iPhone app. At first, I had a strong interest in making iPhone apps, and saw my assignment as an opportunity to get "real" experience for application development. Shortly after I found that it was my mistake - because the project is too big for my tiny "experiences" in Java and Web, and I'm the only one who have assigned to develop the app! I'm now crying out for help, standing in complete darkness of real application development...

Updated on April 13, 2021

Comments

  • Faust V
    Faust V about 3 years

    Our app uses APNS to receive Push Notifications. However, our client claims that some of their devices were not receiving notifications and argues to they 'must' make sure the notifications to be delivered 100%. But I have read somewhere that APNS is not 100% reliable and there should be cases which the notifications are not delivered.

    I'm currently panic at how we could make sure APNS to received anytime. I have read that a case which may APNS not delivered (device may offline). But our test showing that even the device is online (Wifi or 3G), sometimes APNS were not delivered.

    Is there any specific case which may APNS will not delivered? Or is there anything we (developers) can do with codes to make sure to receive all notifications? What I have done in the code is just registering the app to remote notification and write didRegisterForRemoteNotificationsWithDeviceToken, then throw the device token to our server.

    Any help would be appreciated, for our client almost kill us if ALL of their devices not receiving APNS!

  • Faust V
    Faust V over 11 years
    Thank you for your clear answer! Even in the document states and many real developers explained it, our air-headed client won't believe that APNS is not 100% reliable... perhaps they tested on the case 2 and didn't receive the notification. We cannot use third-party implementation, but thanks anyway for good suggestion!
  • deepwinter
    deepwinter about 10 years
    Just a note: The recommendation to implement pusher is not a complete solution, since pusher does not deal with messages missed while offline or the app isn't running. My recommendation for best solution to push message reliability is to use sync-to-sync (where you download and display all messages) with a quality of service sequence number (timestamp) that calls back to the server once the push arrives. If it doesn't arrive, send a sync-to-sync push again. This can achieve 100% delivery. Of course it depends on your needs.
  • Deepak Thakur
    Deepak Thakur almost 10 years
    first you have to deal with the certificates crap.. then you have to deal with apns's unreliability..
  • steve
    steve over 9 years
  • neilb
    neilb over 6 years
    What if the end users device is off?
  • Apps-n-Add-Ons
    Apps-n-Add-Ons over 6 years
    How do you stop the original message from being delivered (in our experience, sometimes up to 3 minutes later.... :(
  • Ben Butterworth
    Ben Butterworth about 3 years
    Or just implement pusher... I don't understand, because Pusher just uses APNs and FCM which are both unreliable services. Pusher does not add reliability.