2 comments on “Process of sending a Push Notification using GCM in a nutshell

  1. Hi lizhong, I have stated that in the above post 🙂

    When sending data to the client, in your JSON you include the data as key:value pairs.
    message details send with “message” key.

    “data” : {
    “message”: “GCM Tests”
    },

    Same way you can define your own key:value pairs in the data section of JSON. Thus you can define a new key called “image” and image url as the value.

    “data” : {
    “message”: “GCM Tests”
    “image” : “url for image”,
    },

    From the client app you can retrieve the “image” in the same way you retrieve “message” separately as follows;

    String messageDetails = extras.getString(“message”);
    String imageUrl = intent.getExtra(“image”);

    ImageLoader.getInstance().displayImage(imageUrl ,messageImageView, options,
    new ImageLoadingListener() {

    @Override
    public void onLoadingComplete(String imageUri,
    View view, Bitmap loadedImage) {
    }

    });

    Hope this is what you expected or else let me know 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s