APNs apns-expiration apns-priority apns-collapse-id字段研究

apns-expiration:过期

A UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can >be discarded.

If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed >if it is unable to deliver the notification the first time. 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.

以秒(UTC)表示的UNIX纪元日期。这个头标识了通知不再有效且可以丢弃的日期。如果这个值是非0,那么APNs会存储通知,并尝试至少传递一次,如果第一次无法提交通知,则需要重复尝试。如果该值为0,则APNs将通知视为立即过期,并且不存储通知或尝试重新提交它。

QoS中提到的过期时间是根据这个来执行的,如果填了一个小时则,设备在一小时内重新启动的话,还是会收到这个消息

apns-priority:优先权

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.

If you omit this header, the APNs server sets the priority to 10.

通知的优先级。指定下列值之一:10立即发送推送消息。具有此优先级的通知必须在目标设备上触发警报、声音或标志。对于只包含内容可用的键的推送通知使用此优先级是错误的。在考虑设备的电源考虑因素的情况下,发送推送消息。具有此优先级的通知可能会被分组并以突发的时间交付。它们被节流,在某些情况下还没有被交付。

如果省略了这个头,那么APNs服务器将设置优先级

优先级如果选择5的话,设备收到消息的时间会延长

apns-collapse-id:合并

Multiple notifications with the same collapse identifier are

displayed to the user as a single notification. The value of this key

must not exceed 64 bytes.

重要:”apns-collapse-id”:”xx” iOS10开始生效。加了这个字段后,设备收到有相同key的消息,会合并成一条。设备不在线,连续发相同key的消息,通知栏只会显示一条。只是设备通知栏展示样式不同,设备在线还是可以收到多条相同id的消息

content-available:静默提示

Include this key with a value of 1 to configure a background update

notification. When this key is present, the system wakes up your app in

the background and delivers the notification to its app delegate

当这个key为1的时候,系统会在后台唤醒你的应用程序并将通知发送给delegate

你可能感兴趣的:(APNs apns-expiration apns-priority apns-collapse-id字段研究)