Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Ionic 3应用程序按预期从FCM web界面接收后台通知,但不使用curl_Android_Curl_Firebase Cloud Messaging_Ionic3_Cordova Plugin Fcm - Fatal编程技术网

Android Ionic 3应用程序按预期从FCM web界面接收后台通知,但不使用curl

Android Ionic 3应用程序按预期从FCM web界面接收后台通知,但不使用curl,android,curl,firebase-cloud-messaging,ionic3,cordova-plugin-fcm,Android,Curl,Firebase Cloud Messaging,Ionic3,Cordova Plugin Fcm,我已经包含了来自Ionic Native的FCM,当我从FCM web界面发送消息时,我可以在后台和前台接收通知。它按预期工作。但是,当Icurl请求时,它只在应用程序位于前台时才起作用。有人知道为什么会这样吗?我什么也没看见 这是我发出的请求 curl -H "Content-type: application/json" -H "Authorization:key=<fcm server key>" -X POST -d '{ "data": { "title": "wow",

我已经包含了来自Ionic Native的FCM,当我从FCM web界面发送消息时,我可以在后台和前台接收通知。它按预期工作。但是,当I
curl
请求时,它只在应用程序位于前台时才起作用。有人知道为什么会这样吗?我什么也没看见

这是我发出的请求

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
curl-H“Content-type:application/json“-H”Authorization:key=“-X POST-d'{“data”:{“title”:“wow”,“msg”:“hello world”},to”:“}”https://fcm.googleapis.com/fcm/send

我还试图模拟FCM web界面的网络流量,看看是否与有效负载字段有关,但仍然没有成功。

我找到了我要找的内容。为了在应用程序关闭或在后台运行时显示通知,负载中必须存在
通知
对象。对我来说,它必须有一个标题或者一个主体字段