提供的注册令牌未注册。出于多种原因,可以取消先前有效的注册令牌

时间:2020-09-04 06:37:23

标签: javascript node.js firebase npm push-notification

我一次发送1000条通知,但所有通知均未发送到设备并出现此错误:

“错误”:{“代码”:“消息/注册令牌未注册”,“消息”:“ 提供的注册令牌未注册。先前有效 可以出于多种原因取消注册令牌。看到 错误文档以获取更多详细信息。

function sendPushNotification(title, token) {
       var payload = {
              notification: {
                     title: title,
                     body: title,
              }
       };

       firebase.messaging().sendToDevice(token, payload)
              .then((response) => {
                     console.log('Successfully sent message:', response);
              })
              .catch((error) => {
                     console.log('Error sending message:', error);
              });
}

0 个答案:

没有答案