android - Sending a notification-only payload to GCM using AWS SNS -


i trying send mobile push notifications gcm via aws sns. according latest gcm 3.0 documentation, 1 may include either "notification" payload or "data" payload (or both). if send notification payload, gcm take care of showing notification on end-user device you.

using amazon sns console, tried sending notification-only payload, encountered following error:

invalid parameter: message reason: invalid notification protocol gcm: data key expected in json message (service: amazonsns; status code: 400; error code: invalidparameter)

i'm sending:

{   "gcm":"{\"notification\":{\"title\":\"test message\"}}" } 

i suspect might issue sns still conforming previous version of gcm , therefore expects "data" key, i'm not sure. else having similar problem or have experience this? thanks!

edit: clarify, want send gcm notification payload , have display alert user automatically described in documentation. right now, i'm beginning wonder if sns forwarding notification payload device.

to answer own question, received following aws support on forums:

you correct, sns not support gcm's "notification" payload type described in documentation. sns supports initial "data" payload type actively working on solution support "notification" type. in meantime, "data" payload works same except client app responsible processing data messages has in past.

so until sns supports gcm notification payload, have handle display of notifications extending class gcmlistenerservice , overriding method onmessagereceived.

update 10/2015: seems sns has implemented support gcm notification payload. if include both "data" , "notification" payloads, "notification" take precedence. observed behavior on sns, not find aws blog/articles announcing this.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -