我正在尝试将fcm-node推送通知发送到设备。我获得成功,但未收到通知。这是我的代码:
const FCM = require('fcm-node');
let sendNotification = function(regToken) {
var serverKey = 'MY_SERVER_KEY';
var fcm = new FCM(serverKey);
var message = {
to: regToken,
notification: {
title: 'Title of push notification',
body: 'Body of push notification',
priority: "high",
time_to_live : 20
}
};
fcm.send(message, function(err, response){
if (err) {
console.log("Something has gone wrong!", err);
} else {
console.log("Successfully sent with response: ", response);
}
});
}
我得到:
Successfully sent with response: {"multicast_id":8758415454661889533,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1543920988555705%03634db303634db3"}]}