我们可以使用 Firebase 向独立用户发送自定义推送通知吗? [英] Can we send custom push notifications to independent users using Firebase?
问题描述
我计划使用 Google Firebase 在我的 Angular 4 网络应用中实现通知.我的应用程序中的每个用户都有自己的一组通知.我已经看到 Firebase 可以将消息广播给用户组或主题的订阅者.但是,有没有办法向独立用户发送自定义通知?如果我必须使用 Pub-Sub 模式,为每个用户 ID 创建一个主题并将通知推送到这些主题是否是正确的方法?
I am planning to implement notifications in my Angular 4 web app using Google Firebase. Every user in my application will have his own set of notifications. I have seen that Firebase can broadcast the messages to a user group or to the subscribers of a topic. But, is there any way to send customized notifications to independent users? If I have to use Pub-Sub pattern, is it a right approach to create a topic for every user id and push notifications to those topics?
提前致谢.
推荐答案
当您在应用(Web、Android 或 iOS)中使用 Firebase 云消息传递时,它会获得一个唯一的实例 ID(通常也称为设备注册令牌).此实例 ID 可用于唯一标识特定设备上的特定应用.
When you use Firebase Cloud Messaging in an app (Web, Android, or iOS) it gets a unique Instance ID (also often called a Device Registration Token). This Instance ID can be used to unique identify that specific app on that specific device.
如果您想向特定设备上的特定应用发送消息,您可以向实例 ID 发送消息,如下所示 这里.
If you want to send a message to that specific app on that specific device, you can send a message to the Instance ID as shown here.
如果用户在多个设备上使用同一个应用程序,并且您想在所有设备上向该用户发送消息,您通常会将实例 ID 组合到一个所谓的设备组中,如下所示 此处.
If a user uses the same app on multiple devices, and you want to send a message to the user on all devices, you'll typically combine the Instance IDs into a so-called device group as shown here.
最后,如果您想向已订阅特定主题的一组用户发送消息,您可以将消息发送到该发布/订阅主题,如下所示 此处.
Finally, if you want to send a message to a group of users who have all subscribed to a specific topic, you can send the message to that pub/sub topic as shown here.
根据您的描述,您似乎希望发送到实例 ID 或设备组.
Given your description it sounds like you're looking to either send to the Instance ID or to a device group.
这篇关于我们可以使用 Firebase 向独立用户发送自定义推送通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!