首页 文章

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

提问于
浏览
0

通过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侧有效载荷

{
  "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/链接富媒体通知 . 请帮我如何排序这个以及我在哪里做错了 .

提前

1 回答

  • 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"
           }
    }
    

相关问题