1 回答

TA貢獻1793條經(jīng)驗 獲得超6個贊
sendToDevice,你需要使用方法send():
// The topic name can be optionally prefixed with "/topics/".
var topic = 'highScores';
var message = {
data: {
score: '850',
time: '2:45'
},
topic: topic
};
// Send a message to devices subscribed to the provided topic.
admin.messaging().send(message)
.then((response) => {
// Response is a message ID string.
console.log('Successfully sent message:', response);
})
.catch((error) => {
console.log('Error sending message:', error);
});
https://firebase.google.com/docs/cloud-messaging/android/send-multiple#build_send_requests
添加回答
舉報