根据Firebase Cloud Messaging documentation如果应用服务器在上游消息中设置了一个字段“delivery_receipt_requested”,当应用确认接收时,它会收到一个发送确认。但是,它仅在应用程序服务器与 XMPP 连接服务器连接时才有效。它不适用于 HTTP 连接服务器。
我是 GCM/FCM 的新手,还没有设置我的服务器。因此,我正在使用 Firebase 控制台来测试我的应用程序是否收到通知。
所以,以下是我的查询。
- “delivery_receipt_requested”字段会被发送到应用程序还是连接服务器本身将使用它?
- 如果应用程序在通知中收到此字段,它需要采取与不包含此字段的通知不同的操作吗?
非常感谢任何对使用此字段的文档或示例实现的引用。
提前致谢。
最佳答案
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.?
应用程序不需要采取任何行动。事实上,应用程序不会收到此字段。
更长的解释:
delivery_receipt
不完全是应用程序收到消息的确认,但它是设备收到消息的确认。在将消息传递到应用程序时崩溃或电池电量耗尽。- 此功能在应用程序外部实现。因此应用程序不需要知道此消息需要送达回执
- 您可以通过在接收消息的方法中调用您的后端来实现更精确的“应用送达回执”。
(就像一个 http 调用:http://mywebsite.com/confirm-msg-processed-successfully.php?id=133
)
关于android - 应用程序是否需要对在 FCM 中使用和不使用 delivery_receipt_requested 收到的消息采取不同的操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38780757/