Send silent push notification from the Firebase console

An attempt to prove a concept that I have been working on for some time, due to the fact that my application receives silent notification. I use Firebase Cloud Messaging because it has less overhead than the developer’s own APNs.

I know that FCM supports silent notifications when you create a payload yourself on your own backend, which, of course, is my intention. However, I want to make sure that I can do what I want to do with this notification, and therefore I want to prove it using the FCM console before spending time creating my backend.

I managed to send standard notifications from here, but not quiet ones. Even when I turn on the content-available flag, I am still warned. I think this is because FCM always includes an alert parameter in JSON. Is there a way to disable this in the test console?

Thank you very much,

+7
source share
2 answers

Unable to send non-standard notifications from the Firebase Console.

A fairly convenient way is to use Postman or curl with the specified authorization header.

 curl -H "Content-type: application/json" -H "Authorization:key=<YOUR-API-KEY>" -X POST -d '{ "data": { "foo": "1","bar": "2"},"to" : "<YOUR-DEVICE-TOKEN>"}' https://fcm.googleapis.com/fcm/send 
+3
source

You REALLY CAN send a silent notification from FCN. Check here .

Note. On iOS, set content_available when the application server needs to send a “send to sync” message. An inactive client application runs your logic in the background, and the application in the foreground sends a didReceiveRemoteNotification: message.

Note that the key you should use is content_available , with an underscore; non- content-available hyphen.

+5
source

Source: https://habr.com/ru/post/1266128/


All Articles