![](/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.