I am trying to send mobile push notifications to GCM via AWS SNS. According to the latest GCM 3.0 documentation, one may include either a "notification" payload or a "data" payload (or both). If you send a notification payload, then GCM will take care of showing the notification on the end-user device for you.
Using the Amazon SNS Console, I tried sending a notification-only payload, but I encountered the following error:
Invalid parameter: Message Reason: Invalid notification for protocol GCM: data key is expected in the json message (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter)
I'm sending:
{
"GCM":"{\"notification\":{\"title\":\"Test Message\"}}"
}
I suspect this might be an issue with SNS still conforming to a previous version of GCM and therefore it expects a "data" key, but I'm not sure. Is anyone else having a similar problem or have any experience with this? Thanks!
EDIT: To clarify, I want to send GCM a notification payload and have it display an alert to the user automatically as described in the documentation. Right now, I'm beginning to wonder if SNS is even forwarding the notification payload to the device.