我已经通过整合云火力地堡的消息正常基于文本的推送通知。推是通过FCM服务器及其工作正常发送。
但我坚持基于媒体推送通知,包括图像和媒体根据通知。我也与格式下面提到邮递员控制台进行测试:
使用服务API。
URL: https://fcm.googleapis.com/fcm/send
Method Type: POST
Headers:
Content-Type: application/json
Authorization: key=your api key
Body/Payload:
{ "notification": {
"title": "Your Title",
"text": "Your Text"
},
"data": {
"message": "Offer!",
"mediaUrl": "https://cdn.pixabay.com/photo/2018/01/21/01/46/architecture-3095716_960_720.jpg"
},
"to" : "to_id(firebase refreshedToken)"
}
通过这个,我只接受正常的基于文本的推动。应该是什么错误,或者在IOS 10或更高版本的设备发送通知丰富正确的方式?
提前致谢。
你应该提供可变的内容和内容提供您的FCM有效载荷。两者都是布尔值,而且也必须通知参数外
{
"to" : "to_id(firebase refreshedToken),
"mutable_content": true,
"content-available": true,
"data": {
"message": "Offer!",
"mediaUrl": "https://cdn.pixabay.com/photo/2018/01/21/01/46/architecture-3095716_960_720.jpg
},
"notification": {
"title": "my title",
"subtitle": "my subtitle",
"body": "some body"
}
}
正确的格式是这样(测试)
{
"to": "deviceFCMtoken",
"notification":{
"title" : "Check this Title",
"subtitle" : "Subtitle",
"body" : "Body",
"mutable_content" : true,
"category" : "categoryID"
},
"data":{
"image-url": "www.something.com"
}
}