【发布时间】:2014-05-29 10:42:10
【问题描述】:
我正在使用 AWS SNS 向苹果设备推送通知。但是,我面临很多关于可以传递给 SNS 的消息长度的问题。例如。
如果我使用以下消息,它将被传递:
{
"default":"This is the default message",
"APNS":"{
\"aps\":{
\"badge\":9,
\"alert\":\"The ninth season of supernatural, an American paranormal drama television series created by Eric Kripke, premiered on October 8, 2013, concluded on May 20, 2014, and contained 23 episodes. On February 14, 201\",
\"sound\":\"default\"
}
}"
}
with alert's value(which is the actual message) : 208 characters
Total characters : 319 characters
但如果我在消息中再添加 1 个字符(警报值),它就不起作用了。
再次,如果我使用以下 json 并减少消息长度(减少 25 个字符)和沿 aps 的 1 个额外参数,则工作长度如下:
{
"default":"This is the default message",
"APNS":"{
\"aps\":{
\"badge\":9,
\"alert\":\"The ninth season of supernatural, an American paranormal drama television series created by Eric Kripke, premiered on October 8, 2013, concluded on May 20, 2014, and contained 23 epis\",
\"sound\":\"default\"
},
\"sound\":\"newMessage.aif\"
}"
}
with alert's value(which is the actual message) : 183 characters
Total characters : 324 characters
但是,如果我在消息(警报值)中再添加 1 个字符,它就不起作用了。
在发送消息之前,我似乎无法弄清楚我需要做多少修剪,以免失败。有人知道吗?
【问题讨论】:
标签: java push-notification apple-push-notifications amazon-sns