What is the maximum length of a Push Notification alert text?

后端 未结 11 1284
北海茫月
北海茫月 2020-11-30 16:28

What is the maximum length of the alert text of an iOS push notification?

The documentation states that the notification payload has to be under 256 bytes in total,

11条回答
  •  青春惊慌失措
    2020-11-30 17:27

    EDIT:

    Updating the answer with latest information

    The maximum size allowed for a notification payload depends on which provider API you employ.

    When using the legacy binary interface, maximum payload size is 2KB (2048 bytes).

    When using the HTTP/2 provider API, maximum payload size is 4KB (4096 bytes). For Voice over Internet Protocol (VoIP) notifications, the maximum size is 5KB (5120 bytes)

    OLD ANSWER: According to the apple doc the payload for iOS 8 is 2 kilobytes (2048 bytes) and 256 bytes for iOS 7 and prior. (removed the link as it was an old doc and it's broken now)

    So if you just send text you have 2028 (iOS 8+) or 236 (iOS 7-) characters available.

    The Notification Payload

    Each remote notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. In iOS 8 and later, the maximum size allowed for a notification payload is 2 kilobytes; Apple Push Notification service refuses any notification that exceeds this limit. (Prior to iOS 8 and in OS X, the maximum payload size is 256 bytes.)

    But I've tested and you can send 2 kilobytes to iOS 7 devices too, even in production configurations

提交回复
热议问题