Why remoteMessage.getData() is coming null in my notification class ? Don't know what the problem is there ,please help me out !!
Bundle[
{
google.sent_time=1472704247501,
gcm.notification.e=1,
gcm.notification.title=Testpush,
from=491403630981,
google.message_id=0: 1472704247506889%9831a5799831a579,
gcm.notification.body=Thisisatestnotificationfromthewebapi,
gcm.notification.data={
'order_id': '795'
},
collapse_key=client
}
]
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.w("fcm", "received notification");
Log.e("dataChat", remoteMessage.getData().toString());
String data="";
try
{
Map<String, String> params = remoteMessage.getData();
JSONObject object = new JSONObject(params);
Log.e("JSON_OBJECT", object.toString());
data=object.getString("order_id");
}catch (Exception e){
}
sendNotification(remoteMessage.getNotification().getTitle(),remoteMessage.getNotification().getBody(),data);
}