Firebase云消息传递订阅多个令牌到一个主题 [英] Firebase Cloud Messaging Subscribe Multiple Tokens to a Topic

查看:181
本文介绍了Firebase云消息传递订阅多个令牌到一个主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个允许用户创建帐户的应用程序。然后我将用户信息存储在Firebase数据库中。我也存储所有的用户设备令牌,以防他们使用多个设备与一个帐户(iPhone,iPad,Android等)。

当用户订阅主题,我希望能够订阅所有关联的设备令牌到该主题,而不仅仅是他们目前正在使用的设备。有什么方法可以在订阅某个主题时指定一个令牌,以便他们可以在其所有设备上接收主题通知。 解决方案


我还将所有用户设备令牌存储在使用具有一个帐户(iPhone,iPad,Android等)的多个设备的情况下。

我假设您使用的是设备组


用户订阅一个主题,我想能够订阅所有关联的设备令牌到该主题,而不仅仅是他们正在使用的设备。有什么方法可以在订阅某个主题时指定一个标记,以便他们可以在其所有设备上接收主题通知。



我想如何做到这一点,是通过你的服务器端。检查连接的标记到您的设备组,然后使用 batchAdd <一>。



我不确定的是,如果可以订阅虽然通知的主题


I have an app that allows users to create an account. I then store user information in the Firebase Database. I also store all of the users device tokens in case they are using multiple devices with one account (iPhone, iPad, Android, etc).

When a user subscribes to a topic, I would like to be able to subscribe all of their associated device tokens to that topic and not just the device they are currently using. Is there a way to specify a token when subscribing to a topic so that they will receive topic notifications on all of their devices.

解决方案

I also store all of the users device tokens in case they are using multiple devices with one account (iPhone, iPad, Android, etc).

I'm presuming from that statement, that you are using Device Groups.

When a user subscribes to a topic, I would like to be able to subscribe all of their associated device tokens to that topic and not just the device they are currently using. Is there a way to specify a token when subscribing to a topic so that they will receive topic notifications on all of their devices.

The way I'm thinking of how to do this, is via your server side. Check the connected tokens to your device group, then subscribe the tokens using the batchAdd.

What I'm not sure is, if it is possible to Subscribe a notification_key to a Topic though.

这篇关于Firebase云消息传递订阅多个令牌到一个主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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