我在react-native
项目中使用react-native-firebase
进行 Firebase 云消息传递。当应用程序运行时或在后台/最小化时,它工作正常。但是当应用程序被杀死或在移动重启后未打开时,不会收到通知。 我正在发送以下机构
https://fcm.googleapis.com/fcm/send
{
"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"
}
}
"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( 尝试在 Postman 或 Insomnia 上使用此格式,检查结构并不要忘记包含 Firebase 键 (AlzaXXXXXX(