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

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

问题描述

我正在测试Firebase JSON,以检查发送到新闻应用程序的通知的送达收据。我可以成功地发送消息到Android应用程序没有任何问题,我收到我的Android应用程序的消息。但是,我想知道如何以及在哪里可以检查通知是否已成功传递到Android应用程序?

如何使用 message_id 和/或 multicast_id 这是为了得到通知的交付状态?我找不到使用Firebase检查投放状态的工作代码示例。有没有人有工作JSON代码通过 message_id 和/或 multicast_id 或另一个查询Firebase消息的交付状态办法? Firebase文档没有举例说明如何做到这一点(或者我错过了这个例子)。



请参阅下面用于将通知发送到Firebase的Firebase JSON新闻应用。任何人的帮助,高度赞赏。

在头文件中,我设置授权 key = firebase_server_key
,内容类型设置为 $ / $ c $> $ $
$ b $ $ $ $ $ $ $ $ $ $ firebase,
通知:{
body:test,
title:Alert,
icon:myicon,
delivery_receipt_requested:true
}
}

邮差输出:

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


解决方案

在评论部分确认@ user7410521的说法。目前没有可用的API来使用 message_id s / multicast_id s来检索交付状态的详细信息除了使用 FCM诊断页一>。请注意,诊断页面只有在应用程序已发布时才可用(对于Alpha测试或更高版本)。



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

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?

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).

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

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
    }
  }

Output from postman:

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

解决方案

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).

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天全站免登陆