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 🙂

    Like

Leave a comment