通过firebase发送富媒体推送通知的教程

时间:2017-07-06 08:07:20

标签: objective-c image firebase notifications rich-media

通过firebase发送通知时,不会触发通知服务扩展。它将显示没有图像的定期通知。

我必须发送的确切有效负载是什么。

我已经尝试过这个有效载荷了:

{ to = fedAu7oCO78:APA91bFAdcwctoVVcj-KtfQwD5hdBN7shcgw9QRgh-xQoLlKgBptqG2fxSYmL9T73BY5yOi81OOFbUVoZJp8b4hwPTCxvK4ZvR6hek, content_available = True, mutable_content = True, notification = { icon = myicon, badge = 1, sound = default, body = testing, title = iostest, NotificationImage = https://NotificationImage/822cf50ae5944995a033c51bf1c857a3banner1.jpg}, data = { mediaUrl = https://www.manijewel.com/NotificationImage/822cf50ae5944995a033c51bf1c857a3banner1.jpg }, 
priority = high, time_to_live = 6000 }

{
   "to": "dWB537Nz1GA:APA91bHIjJ5....",
   "data":
   {
      "message": "Offer!",
      "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
   },
   "notification":
   {
      "body": "Enter your message",
      "sound": "default",
      "content-available": 1,
      "mutable-content": 1
   }
}

我明白了:

我正在为我的项目使用FCM。它有类型的丰富推送通知。我试图修改大多数可能的方法来推动FCM。我只从FCM获得普通推送,而不是图像。

我也在使用push try检查APNS相同的编码。我得到了推送通知的预期设计。

这里是ios side payload

{
  "aps": {
     "alert": "Enter your message",
     "badge": 1,
     "sound": "default",
     "content-available": 1,
     "mutable-content": 1
  },
  "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
}

我使用推送博客和

[1]:https://mobisoftinfotech.com/resources/mguide/ios-10-rich-notifications-tutorial/关联富媒体通知。请帮我解释一下这个问题以及我在哪里做错了。

提前

thanx

1 个答案:

答案 0 :(得分:0)

有效载荷格式应如下所示: -

{
       "to": "dWB537Nz1GA:APA91bHIjJ5....",
       "content_available": true,
       "mutable_content": true,
       "data":
       {
          "message": "Offer!",
          "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
       },
       "notification":
       {
          "body": "Enter your message",
          "sound": "default"
       }
}