jeudi 26 février 2015

GCM data not being passed by AWS SNS

I'm using Amazon SNS to send push notifications to an Android device. If I send the following JSON I can't read the parameters in the data element.


{ "default": "message here", "GCM": { "data": { "message": "This is the message" } } }


I can read the default element but in my broadcastreceiver I can't do this.


protected void onHandleIntent(Intent intent) {



Bundle extras = intent.getExtras();

Log.d("GCM",extras.getString("message");


}


Trying to read the message element causes an error.


If I send directly through GCM I can read all of the parameters that start with data. using the above method with no problem at all.


What am I doing wrong?





Aucun commentaire:

Enregistrer un commentaire