我正在使用fcm-node模块发送Android设备的消息。 我得到了成功回复" 成功发送回复:{" multicast_id":8475336616034933807,"成功": 1,"失效":0," canonical_ids":0,"结果":[{" MESSAGE_ID":" 0: 1476702887389532 995% cf878995cf878"}]} "。
但是我无法在控制台中看到该消息,而且我没有收到任何消息给设备。但是当我尝试通过控制台发送通知时它工作正常。
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "From: " + remoteMessage.getFrom());
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below.
}
答案 0 :(得分:0)
插入
remoteMessage.getNotification().getBody()
试试这个
remoteMessage.getData().get("message")