如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? [英] How to check the delivery status of Firebase message sent to an Android application?

查看:23
本文介绍了如何检查发送到 Android 应用程序的 Firebase 消息的传递状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试 Firebase JSON 以检查发送到新闻应用的通知的送达回执.我可以成功地将消息发送到 Android 应用程序而没有任何问题,并且我在我的 Android 应用程序上收到了消息.但是,我想知道如何以及在哪里可以检查通知是否已成功发送到 Android 应用程序?

I am testing the Firebase JSON to check the delivery receipts of the notification sent to the news app. I can successfully send the message to the Android app without any issues and I receive the message on my Android app. However, I want to know how and where can I check if the notification was successfully delivered to the Android app?

如何使用返回的 message_id 和/或 multicast_id 来获取通知的传递状态?我找不到使用 Firebase 检查交付状态的工作代码示例.有没有人有工作 JSON 代码通过 message_id 和/或 multicast_id 或其他方式查询 Firebase 消息的传递状态?Firebase 文档没有提供有关如何执行此操作的示例(或者我可能错过了示例).

How do I use the message_id and/or multicast_id that is given back to get the delivery status of the notification? I can't find working code examples of checking for delivery status with Firebase. Does anyone have working JSON code to query the delivery status of a Firebase message via the message_id and/or multicast_id or another way? The Firebase documentation does not give examples on how to do this (or maybe I missed the example).

请参阅下方用于向 Firebase 新闻应用发送通知的 Firebase JSON.非常感谢任何人的帮助.

Please see the Firebase JSON below used to send the notification to the Firebase news app. Anyone's help is highly appreciated.

在标题中我设置了授权 key=firebase_server_key并且内容类型设置为 application/json

In the header I set authorization key=firebase_server_key and content type is set to application/json

{
    "to" : "token received from firebase",
    "notification" : {
      "body" : "test",
      "title" : "Alert",
      "icon" : "myicon",
      "delivery_receipt_requested": true
    }
  }

邮递员的输出:

{"multicast_id":7845213569874521,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:4853214789631%31bd1c9631bd1c96"}]}

推荐答案

更新:

诊断工具已于 11 月 30 日被移除,2017年:

您无法再在 Play 管理中心访问 FCM 诊断数据.

You can no longer access FCM diagnostics data in the Play Console.

<小时>

确认@user7410521 在评论部分所说的话.除了使用 FCM 诊断页面.另请注意,诊断页面仅在应用已发布时可用(用于 Alpha 测试或更高版本).


Confirming what @user7410521 said in the comments section. There is currently no available API to make use of the message_ids/multicast_ids to retrieve the details of the delivery status of the message sent, other than using the FCM Diagnostics Page. Do also keep in mind that the Diagnostics page is only usable when the app is already published (for Alpha testing or later).

我注意到您包含 delivery_receipt_requested 有效载荷中的参数.收到消息确认应该足以确定设备收到了消息.

I noticed that you included the delivery_receipt_requested parameter in your payload. Receiving the a message confirmation should be enough to determine that the device received the message.

这篇关于如何检查发送到 Android 应用程序的 Firebase 消息的传递状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆