如何使用 FCM 从 Postman 发送通知?

时间:2021-07-18 08:37:20

标签: flutter dart postman

我正在使用邮递员的 Post 方法向我的 Flutter 应用程序发送通知,如果我以这种方式将正文包含在通知之外,我可以发送通知。

{
    "to": "cu6HFvgXSCyKz5kjp..........",
    "notification": {
        "sound": "default",
        "body": "test body",
        "title": "test title",
        "content_available": true,
        "priority": "high"
    },
    "data": {
        "sound": "default",
        "body": "test body",
        "title": "test title",
        "content_available": true,
        "priority": "high",
        "ride_request_id":"asdfasd"
    }
}

我可以解析数据以从 ride_request_id 获取我的值,但问题是我收到了双重通知,因此 FCM 建议在通知中包含正文,现在,我既没有收到通知也无法解析它。尽管在 Postman 中它显示为成功。

{
    "to": "cu6HFvgXSCyKz5kjp..........",
    "notification": {
        "sound": "default",
        "body": "test body",
        "title": "test title",
        "content_available": true,
        "priority": "high",
        "data": {
            "sound": "default",
            "body": "test body",
            "title": "test title",
            "content_available": true,
            "priority": "high",
            "ride_request_id": "asdfasd"
        }
    }
}

1 个答案:

答案 0 :(得分:0)

这是一篇关于使用邮递员发送通知的文章:

Test FCM Notification with POSTMAN