【问题标题】:Ionic 3 app receives background notifications as expected from FCM web interface, but not with curlIonic 3 应用程序按预期从 FCM Web 界面接收后台通知,但不使用 curl
【发布时间】:2018-02-23 05:38:41
【问题描述】:

我已经包含了来自 Ionic Native 的 FCM,当我从 FCM Web 界面发送消息时,我可以在后台和前台接收通知。它按预期工作。但是,当我 curl 请求时,它仅在应用程序处于前台时才有效。有谁知道为什么会这样?我没有看到任何东西http protocol docs

这是我要发送的请求。

curl -H "Content-type: application/json" -H "Authorization:key=<fcm server key>"  -X POST -d '{ "data": { "title": "wow", "msg": "hello world"},"to":"<fcm token>"}' https://fcm.googleapis.com/fcm/send

我还尝试从 FCM Web 界面模拟网络流量,看看它是否与有效负载字段有关,但仍然没有运气。

【问题讨论】:

    标签: android curl firebase-cloud-messaging ionic3 cordova-plugin-fcm


    【解决方案1】:

    我找到了我要找的东西。为了在应用程序关闭或在后台运行时显示通知,notification 对象必须存在于有效负载中。对我来说,它还必须有一个标题或正文字段。

    【讨论】:

      猜你喜欢
      • 2017-12-04
      • 1970-01-01
      • 2020-06-21
      • 1970-01-01
      • 2021-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-26
      相关资源
      最近更新 更多