如何通过代码直接从应用程序发送推送通知Firebase

时间:2016-11-19 18:17:09

标签: android firebase firebase-cloud-messaging

我想在我的应用中发生事件时发送推送通知,不使用Firebase控制台。 我可以通过json向服务器发送请求吗?如果是这样,怎么样?因为我在这方面遇到了困难。

谢谢

1 个答案:

答案 0 :(得分:0)

你可以send upstream messages from your app to Firebase Cloud Messaging。但是你需要自己的app server to respond to those messages。我建议您阅读documentation on the role of these servers

由于您无法使用Firebase Cloud Messaging发送直接的设备到设备消息,因此某些开发人员可以选择使用Firebase数据库来保留消息队列。您仍然需要一个应用服务器来读取该队列和send the downstream messages to the devices,但至少您不必学习XMPP。