FCM 推送通知“内容”条目

use*_*334 1 push-notification ios firebase firebase-cloud-messaging

我正在使用 FCM 向我的用户发布推送通知,到目前为止效果很好。

目前,我正在尝试实施一个通知内容扩展来提供定制的推送通知和预览,这对本地通知非常有效,遵循这篇文章。据我所知,我必须category在推送通知中设置条目和我的通知类别标识符,以便告诉 iOS 它应该使用哪个通知 UI。

问题是,当我向 FCM 发送以下消息时,在设置了类别条目的情况下,FCM 会删除该条目或将其更改为gcm.notification.category,具体取决于我放置类别条目(aps/data等)的位置

这样 iOS 从不显示我的自定义 UI/扩展。不幸的是,我无法在FCM 文档中找到任何帮助。

发送(POST:https : //fcm.googleapis.com/fcm/send):

{ 
    "notification": {
        "title": "Good Morning",
        "body": "Wake up Jack!",
        "badge" : 1,
        "sound" : "horn.aiff",
        "category" : "Cheers"     <-- Is going to be deleted / changed
    },

    "data" : {
        "time" : "2018-01-19 23:00:00",
        ...
    },

    "mutable_content" : true,

    "priority" : "high",
    "registration_ids" : [
      "abcdefg123456"
    ]
}
Run Code Online (Sandbox Code Playgroud)

已收到:

{
    aps =     {
        alert =         {
            body = "Wake up Jack!";
            title = "Good Morning";
        };
        badge = 1;
        "mutable-content" = 1;
    };

    "gcm.message_id" = "0:1516392279506894%dc84760ddc84760d";
    "gcm.notification.category" = "Cheers";    <-- not working 
}
Run Code Online (Sandbox Code Playgroud)

AL.*_*AL. 5

categoryAPNS参数FCM对应的是click_action

添加自定义参数(使用data消息有效负载)时,iOS 的处理方式不同,并且通常包含在aps有效负载之外(如您提供的示例中)。


归档时间:

查看次数:

1333 次

最近记录:

7 年,11 月 前