![](/img/trans.png)
[英]Android FCM not receiving notifications when app is removed from background
[英]Ionic 3 app receives background notifications as expected from FCM web interface, but not with curl
我已经包含了来自 Ionic Native 的 FCM,当我从 FCM Web 界面发送消息时,我可以在后台和前台接收通知。 它按预期工作。 但是,当我curl
请求时,它仅在应用程序处于前台时才有效。 有谁知道为什么会这样? 我没有看到任何http 协议文档。
这是我发送的请求。
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 界面的网络流量,看看它是否与有效载荷字段有关,但仍然没有运气。
我找到了我要找的东西。 为了在应用程序关闭或在后台运行时显示通知, notification
对象必须存在于有效负载中。 对我来说,它也必须有标题或正文字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.