Android:使用react-native-firebase杀死应用时未收到通知

问题描述 投票:3回答:1

我在react-native-firebase项目中使用react-native进行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"
 }
}
react-native react-native-firebase
1个回答
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本机firebase,您可以通过点击此端点(https://fcm.googleapis.com/fcm/send)尝试在postman或失眠上使用此格式,检查结构并且不要忘记包含firebase密钥(AlzaXXXXXX)

© www.soinside.com 2019 - 2024. All rights reserved.