Reputation: 527
I want to know what is the maximum length of the message sent for push notification, because in my testing issue, I recognized that I have problem in it, when I am trying to send a short message, push notification works well, but if I put a message that has more than 30 characters, the device doesn't receive the push notification.
In my php code, I have this:
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
Is it related or not? and how can I adjust the length of the message?
In my code, I use UTF-8 encoding, is it related also?
Please help, thank you per advance!
Upvotes: 1
Views: 1156
Reputation: 1828
Push notifications are intended to be small; the payload size can be no more than 256 bytes, You can't adjust the length.`
Push notifications whose payload exceeds 256 bytes will not be accepted by APNS.
Upvotes: 0
Reputation: 14169
The documentation (and previous answers) states that your payload is restricted to 256 bytes, i.e. any message that is longer will be refused by the system.
The typical way of dealing with this restriction is to pass a notification id with your push notification and request the full payload directly from your server when entering the app from that push notification.
Upvotes: 1