如何从客户端向每个人发送简单的Firebase推送通知? [英] How to send a simple Firebase push notification to everyone from the client?

查看:92
本文介绍了如何从客户端向每个人发送简单的Firebase推送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在进行大量研究,但似乎所有文章都从控制台发送通知或将推送通知发送到单个设备.

I've been doing so much research, but it seems like all the articles out there are either sending notifications from the console or sending a push notification to a single device.

我只想使用Firebase在我的客户端上发送推送通知,而不在控制台上发送通知给每个人.我需要一台服务器吗?如果是这样,我需要从中检索什么信息?

All I want is to send a push notification using Firebase ON my client and not on the Console to everyone. Do I need a server? If so, what information do I need to retrieve from it?

推荐答案

如果只想发送下游消息,则不需要服务器.您可以简单地使用邮递员 cURL .只需指定要将邮件有效负载发送到的注册令牌/主题即可.

If you simply want to send a downstream message, you don't really need a server. You can simply use Postman or cURL. Just specify the registration token(s)/topic you want to send your message payload to.

如果您打算从客户端(Android应用程序)本身发送下游消息,强烈建议不要这样做.在此处:

If you are aiming to send the downstream message from the client (Android app) itself, I would strongly advise not to. Quoting a portion of @FrankvanPuffelen's answer here:

向设备发送消息(所谓的下游消息)需要HTTP调用,该调用指定服务器密钥.顾名思义,此密钥只能在您可以信任的环境中使用.

Sending a message to devices (so-called downstream messages) requires a HTTP call that specifies the server key. As its name implies, this key should only be used in environments you can trust.

这是为了避免将密钥暴露给未经授权的用户,从而防止利用.

It is to avoid exposing the key to unauthorized users, preventing exploitation.

这篇关于如何从客户端向每个人发送简单的Firebase推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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