我正在使用 FCM 设置一个 android 应用程序通知,以便它可以触发应用程序使用同一应用程序向其他设备(接收器)发送通知并接收通知.我想使用 FCM 但没有 Firebase 数据库,而是使用 PostGreSQL/其他数据库.怎么做?也可以在 AdonisJS 中实现 Firebase 吗?因为我将它用于服务器端.
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.
Firebase Cloud Messaging 不支持直接向设备发送消息到.向设备发送消息(称为下游消息)需要您指定 FCM 服务器密钥,并且(顾名思义)该密钥只能在服务器或其他受信任的环境中使用.
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.
这样做的原因是,拥有项目的 FCM 服务器密钥允许您向该项目中的任何和所有设备发送任何消息,因此在受信任的环境之外提供此密钥将是一个安全问题.
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.
但无需使用 Firebase 数据库发送 FCM 消息.验证这一点的最简单方法是通过命令行 curl 调用发送消息,如下所示:如何在不使用 Firebase 控制台的情况下发送 Firebase 云消息通知? 您还可以实现代码以在其中发送消息Cloud Functions 或您自己喜欢的没有数据库的服务器端环境.您只需将消息发送到函数的目标传递给函数.
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.
这篇关于无论如何,是否可以在没有 Firebase 数据库的情况下使用 FCM 从一台设备向另一台设备发送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!