我正在react-native-firebase
项目中使用react-native
进行Firebase云消息传递。当应用程序正在运行或在后台/最小化时,它工作正常。但是在移动设备重启后应用被终止或未打开时,未收到通知。
我要将以下正文发送到
{
"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" : "propertyAdd",
"sound":"default",
"vibrate":true,
"propertyId":"1"
}
}
答案 0 :(得分:0)
"to":"your token",
"apn": {
"content_available": "1"
},
"content_available": true,
"sound": "default",
"icon": "ic_launcher",
"priority": "high",
"notification": {
"title": "Reminder Appointment",
"body": "You have appointment today with Doctor ${detailData.doctor_name} on ${appTime}"
},
"data": {
"id_appointment": "${detailData.book_id}",
"id_doctor": "${detailData.doctor_email}",
"id_patient": "${detailData.patient_email}",
"speciality": "${detailData.speciality}",
"speciality_id": "${detailData.speciality_id}"
}
如果您使用的是React Native Firebase,则可以通过按此端点(https://fcm.googleapis.com/fcm/send)来尝试在邮递员或失眠时使用此格式,检查结构,不要忘记包含firebase密钥(AlzaXXXXXX)< / p>