Trying to prove a concept I've been working on for a while, which involves my app recieving a silent notification. I am using Firebase Cloud Messaging as it has less overhead than native APNs for the developer.
I know FCM supports silent notifications when you build the payload yourself on your own backend, which is of course my intention. However, I want to make sure I can do what I want to do with this notification, and therefore want to prove it using the FCM console before I spend time writing my backend.
I have managed to send standard notifications from here, but not silent ones. Even when I include the content-available
flag I'm still alerted. I think this is due to FCM always including the alert
parameter in the JSON. Is there a way to disable this in the test console?
Many Thanks,
There is no way to send notifications different from the standard kind from the Firebase Console.
A quite convenient way is to use Postman or curl with a set 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
You actually CAN send silent notifications from FCN. Check here.
Note: On iOS, set content_available when the app server needs to send a send-to-sync message. An inactive client app executes your logic in the background, while an app in the foreground passes the message to didReceiveRemoteNotification:.
Notice that the key you have to use is content_available
, with underscore; different from content-available
which is with a hyphen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With