For our iOS news apps we send out more than 10000 push notifications to registered devices, but somehow not all devices seem to receive the notification. We have been doing this for years but recently we received user feedback stating they did not receive a push notification while they did register their device to receive them.
Our logs show that these specific devices registered successfully and that there were no errors sending the push notification, but somehow the APNS does not deliver the notification. We have seen that removing the app from the device and reinstalling it sometimes solves the problem but we are still concerned.
We think it must be Apple's service that fails to deliver the push notification sometimes, especially when it comes to sending large amounts of notifications. Any of you experienced this?
The Apple docs says this:
Important: Delivery of notifications is a “best effort”, not
guaranteed.
Have you checked the payload size? As per Apple's documentation, the maximum size allowed for a notification payload is 256 bytes.
Related
So, I have about 1000 iOS users installed my app.
I tried to send push notification to these users thru my app's backend panel, however, my devices did not receive the push notification. I also asked some users, and some of them said they did receive the push notification and some did not.
I was wondering why not all of the 1000 iOS users receive the push notification successfully.
At first, I thought it has to do with my applications, because my device has the latest update that is yet to release to public. So I went on and delete all the device tokens I got, and register my device again to test the push notification.
This time, my device received the push notification from backend panel successfully. So, I am sure there is nothing wrong with the coding part on receiving push notifications. (I ran multiple test on this and sure that push are send and receive successfully)
It only happens when I tried to send bulk push notifications to iOS users.
so, is sending push notification has a limit? like it only allows to send may be to 100 users?
or may be there are invalid device token so that pushes are stopped before finish sending to all users? but in what situation device token become invalid? will uninstalled user's device token may be a cause?
In our experience notifications have far from a 100% delivery rate, and that's with only between 50 and a 100 installs across iOS. In theory there is no cap set in place.
The only limits I'm aware of is sending an identical notification to the same device multiple times within a short window of time.
Push notification has some drawback eg:
1. It doesn't revert if its delivered or not
2. If device was off the push notification arrives in bunch. (I don't need the old push notifications if device was off)
For the purposes of displaying messages to users who do not currently have your app open, there is no alternative to Push Notifications.
However, each of the drawbacks you mention does have a solution.
Determining delivery status
There are 2 possible reasons a notification will not be immediately delivered.
The device has uninstalled your app
If the device has uninstalled your app or opted-out of notifications, Apple will return the failed recipient device token through their Feedback Service protocol. In the newest HTTP/2 version of APNS, the failed recipient token will be returned as a response to your HTTP/2 connection.
The device is turned off or does not have a network connection.
Apple will attempt to deliver your most recent notification to the device when the device comes back online. If determining delivery status is essential to you, then you can supply the Content-Available flag and have your application report any successful deliveries of notifications.
Managing notifications when devices are turned off
By default, Apple will deliver only the one most recent notification per application when a device is turned on. This prevents the possibility of a user receiving a deluge of notifications from any single app when they turn on their device.
You can also prevent Apple from delivering old notifications by setting a TTL value. If the TTL expires before Apple is able to successfully send the notification to a device, the notification will be discarded.
I'm trying to send a push notification to a device - which is longer than 255 characters.
I'm not getting any errors from Apple servers but the push notification does not reach my device.
Using Pusher (https://github.com/noodlewerk/NWPusher) the push notification DOES reach the device - using the same certificate.
Sending a push notification smaller than 255 characters DOES reach the device
What could be the issue?
Usually, push notifications that are too long, such as over 255 characters as you have mentioned do not make it into the user's device due to the fact that IOS might believe that these notifications are spam notifications. This also forces the developer to be as concise as possible, so the user can get the full information they need from just a quick glance at the screen of their device.
Also, take a look at the following thread.
According to documentation from Apple Push Notification Service:
Each remote notification includes a payload. The payload contains
information about how the system should alert the user as well as any
custom data you provide. In iOS 8 and later, the maximum size allowed
for a notification payload is 2 kilobytes; Apple Push Notification
service refuses any notification that exceeds this limit. (Prior to
iOS 8 and in OS X, the maximum payload size is 256 bytes.)
The topic I want to discuss may be a duplicate of this question. But still I've a few queries regarding Apple Push Notifications.
I have one app supported on both Android and iOS. The app needs a background service which hits a remote server every minute. The job is simple for Android app but since background tasking is not supported in iOS I need to employ push notifications for iOS app. I am using PushSharp library to deliver push notifications. Apple says that the delivery of push notification is not acknowledged. I cannot afford push notification failure since I need to send a very crucial message through notification. My questions are:
1) What is the failure rate of push notifications?
2) Are push notifications always reliable to send important messages?
3) Assume that the server which is supposed to send push notifications sends a large number of push notifications every minute. What are the chances of push notification failure in such a case?
4) Which circumstances cause push notification delivery to fail?
If you have any useful resources please provide the same. Thanks.
Please find my comments below.Hope this helps.
What is the failure rate of push notifications?
Apple has not disclosed it so far.
Are push notifications always reliable to send important messages?
Delivery of notifications is a “best effort”, not guaranteed. It is not intended to deliver data to your app, only to notify the user that there is new data available.
Please refer - https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
Assume that the server which is supposed to send push notifications sends a large number of push notifications every minute. What are the chances of push notification failure in such a case?
Only one recent notification for a particular application is stored. If multiple notifications are sent while the device is offline, each new notification causes the prior notification to be discarded. This behavior of keeping only the newest notification is referred to as coalescing notifications.
Please refer - https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
Which circumstances cause push notification delivery to fail?
If APNs attempts to deliver a notification but the device is offline, the notification is stored for a limited period of time, and delivered to the device when it becomes available.
Please refer - https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
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!
APNS is based on Apple Servers, and Apple doesn't give any guarantee on successful message delivery.
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.
Notification shows up only when the app is backgrounded or killed.
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).
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
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)
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".
As per Apple's guidelines, APNS is not 100% reliable service which means your app may not get push notifications from Apple servers due to some of the following reasons:
Device is offline
Your app is in the foreground state, you need to manage the push notification.
Note: Apple rejects apps which make compulsion to use notification services. (I have faced it in one of my App)
For more information, you can look into this answer
https://stackoverflow.com/a/25830955/3278326