我知道如何通过POSTMAN发送带有FCM-TOKEN和TOPIC名称的推送通知,但是我不确定如何发送带有包名称的FCM通知,或者仅在我的Firebase项目包含2个以上的特定包时发送FCM通知应用已连接。
{
"to": "/topics/global", // global is your topic
"notification" : {
"body" : "great match!",
"content_available" : true,
"priority" : "high",
"title" : "Portugal vs. Denmark"
},
"data" : {
"body" : "great match!",
"content_available" : true,
"priority" : "high",
"title" : "Portugal vs. Denmark"
}
}
答案 0 :(得分:0)
是的,您可以从邮递员发送通知。 为此,您必须创建一个如下所示的JSON
{
"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"
}
}
选择POST METHOD
输入请求URL作为https://fcm.googleapis.com/fcm/send
添加标题Authorization: key=<server_key>
,您将从Firebase Cloud消息标签中获取它
还有Content-Type: application/json
有关更多信息,请检查此Link
希望这会对您有所帮助。