2
Почему remoteMessage.getData() подходит к нулю в моем классе уведомлений? Не знаю, в чем проблема, пожалуйста, помогите мне!Получить значение из RemoteMessage из FCM в методе onMessageReceived
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);
}
FCM принимать параметр RemoteMessage в onMessageReceived() –
есть вы получите файл конфигурации из консоли firbase? –
... да, я получил это –