Javascript Firebase功能不向设备发送通知

Javascript Firebase功能不向设备发送通知,javascript,node.js,firebase,Javascript,Node.js,Firebase,我的Firebase函数中有一些代码,它将通知放在一起并发送到用户的设备。 但是,在它向令牌发送一个通知并将其交付之后,它发送的未来通知将不会通过。我知道这不是客户端,我所做的只是打印数据。以下是我发送通知的方式: admin.messaging().sendToDevice(recipientToken, payload) .then(function (response) { console.log("Successfully sent message:",

我的Firebase函数中有一些代码,它将通知放在一起并发送到用户的设备。 但是,在它向令牌发送一个通知并将其交付之后,它发送的未来通知将不会通过。我知道这不是客户端,我所做的只是打印数据。以下是我发送通知的方式:

    admin.messaging().sendToDevice(recipientToken, payload)
    .then(function (response) {
        console.log("Successfully sent message:", response);
    })
    .catch(function (error) {
        console.log("Error sending message. Cause: ", error);
    });
是否缺少某种参数或其他内容?

尝试添加

 const options = {
    priority: "high",
}; 
把它放在这里:

  admin.messaging().sendToDevice(recipientToken, payload, options)
.then(function (response) {
    console.log("Successfully sent message:", response);
})
.catch(function (error) {
    console.log("Error sending message. Cause: ", error);
});

不久前我也遇到了同样的问题,所以我希望这能有所帮助。

现在它每次都在发送通知!谢谢