I have migrate gcm to fcm for push notification message.
but how I Get bundle data from RemoteMessage received onMesssageReceived method.
Old GC
Here is the code snippet which is pretty much self Explanatory.
You get the data in the form of the Map
public void onMessageReceived(RemoteMessage remoteMessage)
{
Log.e("dataChat",remoteMessage.getData().toString());
try
{
Map params = remoteMessage.getData();
JSONObject object = new JSONObject(params);
Log.e("JSON_OBJECT", object.toString());
}
}
Make Sure from server you are sending data in correct format i.e. in the "data" key
here is the demo Json file
{
"to": "registration_ids",
"data": {
"key": "value",
"key": "value",
"key": "value",
"key": "value"
}
}