iOS push notifications with sound from Amazon SNS

2016/06/12

Tags: sns ios amazon push notifications push notificatiions sound

When sending push notifications from Amazon SNS, to iOS endpoints, with the default JSON format, they are received without sound.
The default format would look like this:

{  "default" : "Message"}

In order to get sound for push notifications on iOS, the JSON payload should look like this:

{  "default" : "Message",  { "APNS":"{\"aps\":{\"alert\":{\"loc-key\":\"%@\", \"loc-args\":[\"Message\"]}, \"sound\":\"default\"} }" }}

Why does the payload look like this? I have no idea. The point is that it works at the moment this article was written. I’ve found it somewhere on stackoverflow, but I can’t find it again, so I’m just posting it here for whomever needs this information.