通知格式FCM firebase



我用邮递员测试了一个推送通知fcm。当我把我的数据通过

{
"to" : "YOUR_FCM_TOKEN_WILL_BE_HERE",
"collapse_key" : "type_a",
"notification" : {
"body" : "Body of Your Notification",
"title": "Title of Your Notification"
},
"data" : {
"body" : "Body of Your Notification in Data",
"title": "Title of Your Notification in Title",
"key_1" : "Value for key_1",
"key_2" : "Value for key_2"
}
} 

我收到通知。但当我将其更改为自定义通知时

{
"to" : "YOUR_FCM_TOKEN_WILL_BE_HERE",
"collapse_key" : "type_a",
"data" : {
"body" : "Sending Notification Body From Data",
"title": "Notification Title from Data",
"key_1" : "Value for key_1",
"key_2" : "Value for key_2"
}
}

我不再收到任何通知。有人知道这个问题吗?我关注这篇文章https://medium.com/android-school/test-fcm-notification-with-postman-f91ba08aacc3

我的感谢!!!

您的第二条语句中缺少这一点,这是必需的:

"notification" : {
"body" : "Body of Your Notification",
"title": "Title of Your Notification"
},

最新更新