应用程序是否需要对在 FCM 中使用和不使用 delivery_receipt_requested 收到的消息采取不同的操作?

Does the app need to act differently on messages received with and without delivery_receipt_requested in FCM?

根据Firebase Cloud Messaging documentation,如果应用服务器在上游消息中设置了一个字段"delivery_receipt_requested",当应用确认接收时,它会收到一个发送确认。但是,它仅在应用程序服务器与 XMPP 连接服务器连接时才有效。它不适用于 HTTP 连接服务器。

我是 GCM/FCM 的新手,还没有设置我的服务器。因此,我正在使用 Firebase 控制台来测试我的应用程序是否收到通知。

所以,以下是我的查询。

  1. 字段 "delivery_receipt_requested" 会被发送到应用程序还是连接服务器本身会使用它。?
  2. 如果应用程序在通知中收到此字段,它需要采取与不包含此字段的通知不同的操作。?

非常感谢任何对使用此字段的文档或示例实现的引用。

提前致谢。

Will the field "delivery_receipt_requested" be sent to the app or the connection server itself will consume it.?

安装在 Google Play 服务中的 FCM 客户端将处理此问题。 应用程序不会注意到任何不同。

If the app receives this field in a notification will it need to act differently from the notification which do not contain this field.?

应用程序不需要执行任何操作。事实上,该应用程序不会收到此字段。


更长的解释:

  1. delivery_receipt 不完全是应用程序收到消息的确认,但 这是设备收到消息的确认。 需要说明的是,仍然有可能将消息传递到应用程序时设备崩溃或 运行 没电了。
  2. 此功能在应用程序外部实现。因此应用程序不需要知道此消息需要送达回执
  3. 您可以通过在接收消息的方法中调用后端来实现更精确的"application delivery receipt"。
    (比如对 http://mywebsite.com/confirm-msg-processed-successfully.php?id=133 的 http 调用)