click here to check postman request
在将 GCM 迁移到 FCM 时,我在 GCM 请求正文的请求正文中使用了 aps 参数,但是当对 FCM 尝试相同时,它显示 InvalidParameters。
网址:https://fcm.googleapis.com/fcm/send
要求:
{
"notification": {
"title": "notification title",
"body": "message body changed 11"
},
"data": {
"mt": "re",
"offerid": "10562",
"aps":{"badge":0,"alert":"gauravtest,$20 OFF COUPON","sound":"null.caf"},
"clpnid": "xxx",
"custid": "xxx",
"eoid": "0",
"pc": "171-2802-8180",
"ed": "11/08/2017",
"ag": "",
"url": "",
"previewimage": ""
},
"to": "xxxx"
}
响应:
{
"multicast_id": 6282546760147817634,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "InvalidParameters"
}
]
}
最佳答案
由于某些原因,在将 data
对象与 notification
对象组合时,不允许使用 aps
参数。
如果您删除notification
对象,消息将成功发送,但您将发送一个data push message。而不是通知推送消息。
关于java - 无法在 payload FCM 的 body 请求中传递 aps 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46621248/