Skip to content Skip to sidebar Skip to footer

Gcm Push Notification Without Using Json

I am trying to migrate my application from C2DM service to new GCM push notification. I have successfully integrated the GCMIntentService class which extends GCMBaseIntentService.

Solution 1:

you have to send the payload via JSON - whats the reason you do not want to use JSON?

Solution 2:

You can indeed send payload without JSON (if you preferred), just like C2DM.

First, the content type is changed to this:

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Then your HTTP body will contain this:

registration_id=xxxxxx&collapse_key=yyyyy&data.data1=value1&data.data2=value2

HOWEVER, by sending payload as plain text you can only send it to one device at a time. This reason alone should make you avoid using this option, unless you already have bulk-sending logic in your C2DM code that you don't wish to change.

See here for more details: http://developer.android.com/guide/google/gcm/gcm.html#request

Post a Comment for "Gcm Push Notification Without Using Json"