【问题标题】:How to add mutable_content in APNS payload using Firebase Notifications console?如何使用 Firebase 通知控制台在 APNS 有效负载中添加 mutable_content?
【发布时间】:2017-04-05 06:36:00
【问题描述】:

无法弄清楚如何在 aps 字典中发送 mutable_content=true。这是我从 Firebase 消息传递控制台发送通知时收到的 json 有效负载

{
    aps =     {
        alert =         {
            body = "50% off on booking ";
            title = "CompanyName 50% coupon ABC50OFF";
        };
        sound = default;
    };
    "attachment-url" = "https://www.xxxxxxxxx.com/campaign/images_thumb/Toyota-Fortuner-AT.jpg";
    "click_action" = reminder;
    "content_available" = 1;
    "gcm.message_id" = "0:1491225835295720%a84b45aaa84b45aa";
    "gcm.n.e" = 1;
    "gcm.notification.sound2" = default;
    "google.c.a.c_id" = 3829383583613273032;
    "google.c.a.e" = 1;
    "google.c.a.ts" = 1491225835;
    "google.c.a.udt" = 0;
    "mutable_content" = 1;
}

【问题讨论】:

    标签: ios firebase firebase-cloud-messaging firebase-notifications


    【解决方案1】:

    目前无法在使用 Firebase 通知控制台时设置 mutable_content 的值。您必须自己构建有效负载,如下所示:

    {
        "to": "<REGISTRATION_TOKEN_HERE>",
        "mutable-content" : true,
        "notification": {
            "body" : "Eureka!",
            "title": "Patient is not doing well",
            "click_action" : "provider-body-panel"
        }
    }
    

    然后从您自己的应用服务器发送它。您也可以通过using Postman 或cURL 进行此操作

    来自我的回答 here 的修改部分。

    【讨论】:

      【解决方案2】:

      答案不正确,您应该使用“mutable_content”而不是“mutable-content”

      {
          "to": "Token",
          "mutable_content" : true,
          "notification" : {
          "body" : "great match!",
          "title": "check"
          }
      }
      

      【讨论】:

        【解决方案3】:

        在从 Firebase 通知控制台发送推送通知时添加 Notification image。它会自动在payload中添加"mutable-content" : true。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2016-09-21
          • 1970-01-01
          • 2021-03-15
          • 2017-01-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多