What happens to push notifications after losing internet access?

久未见 提交于 2019-12-19 04:04:44

问题


What happens if an application is waiting for a push notification and the internet connection is unavailable?

For example, I tell my server to do task "A", and notify me via APNS when the task is ready. But, after I send the task to the server, the application loses internet connectivity.


回答1:


Notification will be delivered when internet connection on iPhone becomes available again.

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.

See "Quality of Service" section of Local and Push Notification Programming Guide.




回答2:


Be careful when sending PUSHes with own server API, and also take into account apns-expiration field in APNs Provider API payload.

This header identifies the date when the notification is no longer valid and can be discarded...

...if the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it...

By Apple.

It can be the reason, that the push notification does not come after network connection was restored.



来源:https://stackoverflow.com/questions/9007880/what-happens-to-push-notifications-after-losing-internet-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!