如何通过代码直接从应用发送推送通知Firebase [英] How to send push notification Firebase direct from app by code

查看:117
本文介绍了如何通过代码直接从应用发送推送通知Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在应用中发生事件时发送推送通知,不使用Firebase控制台. 我可以通过json向服务器发送请求吗?如果是这样,怎么办?因为我在这部分上有困难.

I want to send a push notification when an event happens in my app, without using the Firebase console for this. Can I send a request by json to the server? And if so, how? Because I have difficulties in this part.

谢谢

推荐答案

您可以将上游消息从您的应用发送到Firebase Cloud Messaging .但是您将需要自己的应用服务器来响应这些消息.我建议阅读关于这些服务器的作用的文档.

You can send upstream messages from your app to Firebase Cloud Messaging. But you will need your own app server to respond to those messages. I recommend reading the documentation on the role of these servers.

由于您无法使用Firebase Cloud Messaging发送直接的设备到设备消息,因此某些开发人员的替代方法是使用Firebase数据库来保留消息队列.您仍然需要一个应用服务器来读取该队列,然后发送下游消息,但至少您不必学习XMPP.

Since you cannot send direct device-to-device messages with Firebase Cloud Messaging, an alternative for some developers is to use the Firebase Database for keeping a queue of the messages. You'll still need an app server to read that queue and send the downstream messages to the devices, but at least you won't have to learn XMPP.

这篇关于如何通过代码直接从应用发送推送通知Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆