iOS PushKit (VoIP Push Notifications) Quality of Service - ios

What is the PushKit QoS policy? The policy for the regular push notification is defined as store-and-forward.
Apple Push Notification service includes a default Quality of Service
(QoS) component that performs a store-and-forward function.
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.
Only one recent notification for a particular app 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.
If the device remains offline for a long time, any notifications that
were being stored for it are discarded.
What about PushKit notification? Is it the same as for regular push notifications?

I performed the following steps to verify the issue myself
Put the device in airplane mode
Sent at least 5 different PushKit notifications
Wait for about 3 minutes
Cancel the airplane mode
Only the last PushKit notification arrived which is compatible with the store-and-forward Apple's policy (which is specifically defined for regular remote push notifications).

Related

What is the difference between VoIP notifications and notification sent with apns-priority 10?

Here's what docs state:
The priority of the notification. Specify one of the following values:
10–Send the push message immediately. Notifications with this priority
must trigger an alert, sound, or badge on the target device. It is an
error to use this priority for a push notification that contains only
the content-available key.
5—Send the push message at a time that takes into account power
considerations for the device. Notifications with this priority might
be grouped and delivered in bursts. They are throttled, and in some
cases are not delivered.
And about VoIP:
Instead of persistent connections, developers should use the PushKit
framework—APIs that allows an app to receive pushes (notifications
when data is available) from a remote server. Whenever a push is
received, the app is called to action. For example, a VoIP app could
display an alert when a call is received, and provide an option to
accept or reject the call. It could even begin taking precursory steps
to initiate the call, in the event the user decides to accept.
Do I understand correctly that apns-priority defines message queuing at APNS side, and VoIP push type defines what happens on the device?
And what do they mean saying
It is an error to use this priority for a push notification that contains only the content-available key.
Will APNS return an error or is it just a bad practice?
P.S. I use AWS SNS for sending notifications and it does not support customisation of apns-priority, but I am curious how it affects the process.
The main difference is that even if your app is closed voip notification can wake your app for kill/suspended state and user notification just shows an alert without waking up your app for more refer.
Apple documentation for pushkit
The main difference is that VoIP notification will launch your app if it's not running or was killed from app switcher and you need to handle the notification in your code, while the normal notification will be shown immediately as local notification and will not start your app.

iOS. Send push to devices which are offline

I want to send push notification to app users. Users whom online will receive it immediately, right?. But what about users whom offline? Will they get notification after they become online?
Can you tell me more about than push notifications will de delivered?
Are messengers use pushes to send notifications about new messages?
Not possible in offline.
Check it: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the device is offline, the QoS stores the notification. It retains only one notification per application on a device: the last notification received from a provider for that application. When the offline device later reconnects, the QoS forwards the stored notification to the device. The QoS retains a notification for a limited period before deleting it.
If a device remains offline for a long time, all notifications that were being stored for it are discarded; when the device goes back online, none of the notifications are displayed.
Basically Apple will try to deliver the notification when the device will become online again (in a resonable time frame).
Apple Push Notification service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the destination device is offline, APNs stores the notification for a limited period of time and delivers it to the device when the device becomes available.
From https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9

IOS Push Notification while device OFF or out of network

I am developing an IOS app and I noticed that the notification arrives only when the device is ON and has internet access but if the device is OFF or out of network then NO notifications will be received.
Apple's Quality of Service https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
It retains only one notification per application on a device:
Apple Push Notification Service includes a default Quality of Service
(QoS) component that performs a store-and-forward function. If APNs
attempts to deliver a notification but the device is offline, the QoS
stores the notification. It retains only one notification per
application on a device: the last notification received from a
provider for that application. When the offline device later
reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting
it.

Is there any alternative then Push Notifications on iOS

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.

Can an iOS push notification selectively replace a prior notification?

I am using iOS push notifications. In Android you can set up to 4 notification keys and then using these keys you can have notifications replace prior notifications if they have not yet been read/seen by the user.
Do iOS push notifications also allow you to selectively replace prior notifications? (E.g. using a common notification key) or do they always "rack up" and cannot be replaced.
Link: Local and Push Notification Programming Guide:
Quality of Service
Apple Push Notification service includes a default Quality of Service
(QoS) component that performs a store-and-forward function.
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.
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.
If the device remains offline for a long time, any notifications that
were being stored for it are discarded.
There's no such mechanism in place in iOS.
After sending a push notification you have no control over it anymore.

Resources