【发布时间】:2018-12-06 02:29:55
【问题描述】:
我正在 kotlin 中制作一组脚本来测试推送通知,以重构与通知相关的遗留代码。 我需要使用这样的有效负载向 gcm 服务器发送发布请求,这会导致通知到达我的手机,其中包含字段“gcm.notification.body”,我似乎无法做到。 目前我正在尝试使用 Postman 来计算有效负载。我得到的“最接近”是“gcm.notification.data”和“fcm.notification.body”。
首先使用此请求正文:
{
"to": "someDeviceToken",
"notification":{
"data":{
"title": "Title supported",
"message": "Notification Message",
"type": "example",
"id": 345,
"priority": 1,
"data": {
"images": [
"https://someimage.com/image.png"
]
}
}
}
}
第二个:
{
"to": "someDeviceToken",
"data":{
"fcm.notification.body":{
"title": "Title supported",
"message": "Notification Message",
"type": "example",
"id": 345,
"priority": 1,
"data": {
"images": [
"https://someimage.com/image.png"
]
}
}
}
}
我在任何地方都找不到任何东西。谢谢
【问题讨论】:
-
FCM is the new improved GCM。 fcm.notification.body 有什么问题?
-
我创建的脚本旨在模拟当前状态 - 在当前状态下,我们正在接收 gcm.notification.body
标签: json push-notification google-cloud-messaging http-post postman