使用 Firebase 实时推送通知

编程入门 行业动态 更新时间:2024-10-26 00:28:21
本文介绍了使用 Firebase 实时推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近注册使用 Firebase,但似乎不知道如何向特定用户推送通知.

I recently signed up to use Firebase and I can't seem to figure out how to push notifications to specific users.

就我而言,我猜你可以把它想象成 Facebook.每当用户做某事时,比如发布一篇有趣的文章供他们的朋友阅读,我希望该用户的所有朋友都能收到该事件的通知.那么,使用 Firebase,如何才能仅通知他们的朋友而不是所有人?我的数据库存储连接.

For my use, I guess you can think of it like Facebook. Whenever a user does something, say posts an interesting article for their friends to read, I want all of the user's friends to be notified of that event. So, using Firebase, how would one make it possible to notify only their friends and not everyone? My database stores the conenctions.

也许有一种方法可以让每个用户成为 Firebase 数据库中的一个节点,并且每次发送通知时,用户都会不断检查他的节点,如果出现了什么,则将其拉取然后删除.

Perhaps there is a way to have each user be a node in the Firebase database and each time a notification is sent, The user will constantly check his node, and if something appears, pulls it and then delete it.

Firebase 上的示例似乎有点基础.我希望有一个特定于用户的推送通知示例.

The examples on Firebase seems to be sort of basic. I wish there was a user-specific push notification example.

推荐答案

现在 Firebase 支持推送通知.Google 将 GCM 更名为 Firebase Cloud Messaging,现在提供这种跨平台服务.Firebase 还提供通知.

Now Firebase supports Push Notification. Google rebranded GCM to Firebase Cloud Messaging and it now offers this cross platform service. Firebase also offers notifications.

以下是这两种服务之间的区别:

These are the differences between these two services:

Firebase Cloud Messaging 通过其客户端 SDK 以及 HTTP 和 XMPP 服务器协议提供了一套完整的消息传递功能.对于具有更复杂消息传递要求的部署,FCM 是正确的选择.

Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.

Firebase 通知是一种基于 Firebase 云消息传递的轻量级无服务器消息传递解决方案.借助用户友好的图形控制台和减少的编码要求,Firebase 通知让用户可以轻松发送消息以重新吸引和留住用户、促进应用增长并支持营销活动.如果你想要更详细的比较.阅读这个.

Firebase Notifications is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, Firebase Notifications lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns. If you want a more detailed comparison. Read this.

这篇关于使用 Firebase 实时推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-28 03:49:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/717673.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实时   通知   Firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!