she*_*ath 1 apple-push-notifications ios firebase firebase-cloud-messaging ios10
我需要用于静默通知的通知有效负载示例,我在下面的结构中尝试了此方法,但是它不起作用
{
"notification" : {
"body" : " Survey list updated",
"content-available:" : true,
"data" : {
"isNewUpdateAvailable" : "easysurvey.survey_list_updated"
}
},
"to" : "f6PwToRUxk0:APA91bG7bSWoKsjHXVmXaiDEnFXA2x2jEOMSO6eGCqPv1fRd-dctNLDEabRq-0So_obuPGFqOFTSLJl5FFyuOuXKBXh-n89BmzzXenRTxoirY9Y1c6-J9MxpDp0ojHL2xm1law0V6gg3"
}
Run Code Online (Sandbox Code Playgroud)
使用此结构,我可以接收通知,但它不是静音的,不会唤醒应用程序。我需要Firebase通知的解决方案,并且在iOS 10上,我遵循的是相同的Firebase示例代码
我得到了答案,用这种方式编写有效负载结构。
{
"data":{
"title":"mytitle",
"body":"mybody",
"url":"myurl"
},
"notification":{
"title":"mytitle",
"body":"mybody",
"content_available": true
},
"to":"DEVICE_FCM_TOKEN"
}
Run Code Online (Sandbox Code Playgroud)
这可能会帮助某人。如果您希望使用POSTMAN Api客户端测试FCM通知,请使用“ key = YOUR_SERVER_KEY”
