Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS- Apple push notification resend from APNS

From Apple's document I understand that if the device is offline, the APNS holds the last notification and sends it to the device when the device is back online. Is there is any mechanism to avoid that resending?

like image 619
Mary Avatar asked Sep 11 '13 11:09

Mary


2 Answers

The correct answer is YES

If you send notifications using the enhanced binary format (the one that includes message identifier and expiry), you can use the expiry parameter to prevent the notification from being stored in the APN server. This way the notification is delivered only if the device is online when the APN server first tries to deliver it.

Expiry

A fixed UNIX epoch date expressed in seconds (UTC) that identifies when the notification is no longer valid and can be discarded. The expiry value uses network byte order (big endian). If the expiry value is positive, APNs tries to deliver the notification at least once. Specify zero (or a value less than zero) to request that APNs not store the notification at all.

like image 180
Eran Avatar answered Oct 14 '22 14:10

Eran


The answer is NO

Here is what apple says about it,

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.

like image 35
thatzprem Avatar answered Oct 14 '22 13:10

thatzprem