Ad

Is There Anyway To Send Notification From One Device To Other Device Using FCM Without Firebase Database?

I'm setting up an android apps notification with FCM so it can trigger the app to send notification to other device(receiver) using the same app and receive the notification. I want to use FCM but without Firebase Database but instead using PostGreSQL/other DB. How to do it? also is it possible to implement Firebase in AdonisJS? because I use that for server-side.

Ad

Answer

Firebase Cloud Messaging does not support directly sending messages to a device. Sending a message to a device (known as a downstream message) requires that you specify the FCM server key, and (as its name implies) that key should only be used on a server, or otherwise trusted environment.

The reason for this is that having the FCM server key for a project allows you to send any message to any and all of the devices in that project, so having this available outside of a trusted environment would be a security concern.

But there is no need to use the Firebase Database to send FCM message. The simplest way to verify this is to send a message through a command line curl call, like shown here: How can I send a Firebase Cloud Messaging notification without use the Firebase Console? You can also implement the code to send a message in Cloud Functions or your own favorite server-side environment without a database. You'll just have to pass in the target of where to send the message into the function.

Ad
source: stackoverflow.com
Ad