Parsing bundle from android push notification
android, bundle, json
Solution
In the method that received the intent do this:
protected void onMessage(Context context, Intent intent) {
//log the message in JSON format
Log.i(TAG, "Received message >> " + intent.getExtras().toString());
//Retrieve message and extra
String message = intent.getExtras().getString("message");
}
Problem
I am using GCM to push notification to mobile using this example and the notification is pushed. But I could not able to parse the bundle received from intent. This is the bundle I got from log `Bundle[{message={"valid":"bbb","deal":"its working","address":"some","name":"aaa"}, android.support.content.wakelockid=1, collapse_key=do_not_collapse, from=198162727742}]` . and I converted it into string and then tried to convert to json object using this code`json = new JSONObject(message);` but no luck. can anybody tell what I am doing wrong here. thanks in advance