Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APNS (Apple Push Notification Service) reliability

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!

like image 686
Faust V Avatar asked Dec 16 '12 00:12

Faust V


People also ask

Is APNs reliable?

As per Apple's guidelines, APNS is not 100% reliable service that means your app may not get the push notifications from Apple servers due to some of following reasons: Device is offline. Your app is in the foreground state, you need to manage the push notification.

Are Apple push notifications guaranteed?

The system makes every attempt to deliver local and remote notifications in a timely manner, but delivery isn't guaranteed. The PushKit framework offers a more timely delivery mechanism for specific types of notifications, such as those VoIP and watchOS complications use.

How long is an Apple Push Notification Service certificate valid for?

APN certificate(s) downloaded from Apple only have one year validity from the date it was created.

What does Apple Push Notification Service do?

Each mobile app platform, such as iOS and Android, has its own OSPNS, or operating system push notification service, that developers can use to deliver push notifications. Registering with an operating system's push notification service allows you, the app publisher, to access the OSPNS API.


2 Answers

  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

like image 103
Karthik Avatar answered Sep 28 '22 11:09

Karthik


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)

like image 32
pdaire Avatar answered Sep 28 '22 13:09

pdaire