【问题标题】:Tutorial for sending rich media push notification via firebase通过 firebase 发送富媒体推送通知的教程
【发布时间】:2017-12-10 02:56:10
【问题描述】:

通过 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 的普通推送,而不是图片。

我还在使用推送尝试检查 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/ 链接富媒体通知。请帮助我如何排序以及我在哪里做错了。

提前感谢

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

    • 它是一个基本的 payload.m 讨论 ios 10 的富媒体通知。对于可变内容和可用内容是触发服务扩展所必需的
    • 已经尝试过,但仍然不会触发服务扩展
    • 确保您在 FCM 有效负载中使用 mutable_content 和 content_available 而不是 mutable-content 和 content-available。
    • 是的,只有...上传到firebase控制台的p12文件属于项目。我必须用扩展p12替换它吗?@ Neha Gupta
    猜你喜欢
    • 1970-01-01
    • 2019-03-18
    • 2017-07-03
    • 1970-01-01
    • 1970-01-01
    • 2020-12-24
    • 1970-01-01
    • 2018-04-28
    • 1970-01-01
    相关资源
    最近更新 更多