我想在应用程序处于前台时显示通知,并且它仅接收WhatsApp和其他应用程序显示的FCM。在后台,我在通知栏上收到通知,但是当用户使用该应用程序时,没有收到任何通知。我从顶部看像默认的android小弹出窗口。我正在使用以下正文发送FCM。
{
"to": "/topics/chatProperty_P00025_14",
"notification" : {
"body" : "great match!",
"content_available" : true,
"priority" : "high",
"title" : "Portugal vs. Denmark",
"sound":"default",
"vibrate":true
},
"data" : {
"body" : "14_P00025",
"content_available" : true,
"priority" : "high",
"title" : "Portugal vs. Denmark",
"type" : "propertyChat",
"sound":"default",
"vibrate":true
}
}
答案 0 :(得分:0)
请参见以下示例代码:
let message = {
to: "fcm_device_token",
data: {
custom_notification: {
body: "Your message",
custom_data: "Any custom data you want to send",
sound: 'default',
priority: "high",
show_in_foreground: true
}
}
}