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

apns-expiration:過(guò)期

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紀(jì)元日期。這個(gè)頭標(biāo)識(shí)了通知不再有效且可以丟棄的日期。如果這個(gè)值是非0,那么APNs會(huì)存儲(chǔ)通知,并嘗試至少傳遞一次,如果第一次無(wú)法提交通知,則需要重復(fù)嘗試。如果該值為0,則APNs將通知視為立即過(guò)期,并且不存儲(chǔ)通知或嘗試重新提交它。

QoS中提到的過(guò)期時(shí)間是根據(jù)這個(gè)來(lái)執(zhí)行的,如果填了一個(gè)小時(shí)則,設(shè)備在一小時(shí)內(nèi)重新啟動(dòng)的話,還是會(huì)收到這個(gè)消息

apns-priority:優(yōu)先權(quán)

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.

通知的優(yōu)先級(jí)。指定下列值之一:10立即發(fā)送推送消息。具有此優(yōu)先級(jí)的通知必須在目標(biāo)設(shè)備上觸發(fā)警報(bào)、聲音或標(biāo)志。對(duì)于只包含內(nèi)容可用的鍵的推送通知使用此優(yōu)先級(jí)是錯(cuò)誤的。在考慮設(shè)備的電源考慮因素的情況下,發(fā)送推送消息。具有此優(yōu)先級(jí)的通知可能會(huì)被分組并以突發(fā)的時(shí)間交付。它們被節(jié)流,在某些情況下還沒(méi)有被交付。

如果省略了這個(gè)頭,那么APNs服務(wù)器將設(shè)置優(yōu)先級(jí)

優(yōu)先級(jí)如果選擇5的話,設(shè)備收到消息的時(shí)間會(huì)延長(zhǎng)

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開(kāi)始生效。加了這個(gè)字段后,設(shè)備收到有相同key的消息,會(huì)合并成一條。設(shè)備不在線,連續(xù)發(fā)相同key的消息,通知欄只會(huì)顯示一條。只是設(shè)備通知欄展示樣式不同,設(shè)備在線還是可以收到多條相同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

當(dāng)這個(gè)key為1的時(shí)候,系統(tǒng)會(huì)在后臺(tái)喚醒你的應(yīng)用程序并將通知發(fā)送給delegate

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容