与iOS设备上的火力点和发送推送通知与FCM丰富的推送通知

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

我已经通过整合云火力地堡的消息正常基于文本的推送通知。推是通过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或更高版本的设备发送通知丰富正确的方式?

提前致谢。

swift firebase push-notification ios11 cordova-plugin-fcm
2个回答
0
投票

你应该提供可变的内容和内容提供您的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"
 }
}

0
投票

正确的格式是这样(测试)

{
    "to": "deviceFCMtoken",

    "notification":{
        "title" : "Check this Title",
        "subtitle" : "Subtitle",
        "body" : "Body",
        "mutable_content" : true,
        "category" : "categoryID"
    },

    "data":{
        "image-url": "www.something.com"
    }

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