【问题标题】:Duplicate FCM push notifications重复的 FCM 推送通知
【发布时间】:2018-06-24 05:47:59
【问题描述】:

今天,我在大约 30 分钟内收到重复的 FCM 推送通知。这些推送通知在内容方面是相同的,并且推送通知被发送一次。这是我收到这些推送通知时的时间线:

1   01-15 10:41:30.349+0200 MyPushListenerService   onMessageReceived
1   01-15 10:43:30.004+0200 MyPushListenerService   onMessageReceived
1   01-15 10:47:31.665+0200 MyPushListenerService   onMessageReceived
1   01-15 10:55:32.062+0200 MyPushListenerService   onMessageReceived

为什么会这样?

Firebase 如何确认推送通知已送达?有重试机制吗?

【问题讨论】:

  • 会不会是你在同一个服务上注册了2个token?在 1 台设备上安装 2 种风格的同一个应用程序时发生在我身上
  • @thepoosh 这能解释我在 30 分钟后仍然收到相同的推送通知吗?另外,我只安装了 1 种应用。
  • 你解决了吗?我有同样的问题。

标签: android firebase push-notification firebase-cloud-messaging


【解决方案1】:

首先,您应该检查触发 FCM 发送消息的原因。如果它是由 Firebase Google Cloud Function 触发的,那么您可以使用 Firebase 控制台查看 index.js 文件中的日志。

此外,您可以通过获取“响应”并将其记录在 Firebase 控制台中来检查 Firebase 是否发送了消息。

例如,在 Cloud Functions 中:

return admin.messaging().sendToDevice(token_id, payload).then(response => {
    console.log('notification sent successfully: ' + response);
    }).catch((error) => {
         console.log('notification sent error ' + error);
    });
});

然后查看您的 Firebase 控制台、函数日志 - 并查看输出是什么。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-09
    • 2022-07-13
    • 2020-04-21
    • 1970-01-01
    • 2020-09-17
    • 1970-01-01
    相关资源
    最近更新 更多