我们可以使用Firebase向独立用户发送自定义推送通知吗? [英] Can we send custom push notifications to independent users using Firebase?

查看:96
本文介绍了我们可以使用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 Cloud Messaging时,它将获得唯一的实例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.

最后,如果要将消息发送给已都订阅了特定主题的一组用户,则可以将消息发送到该pub/sub主题,如

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屋!

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