订阅设备组(notification_key)到主题 [英] Subscribe a Device Group (notification_key) to a Topic

查看:80
本文介绍了订阅设备组(notification_key)到主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了这个帖子,其中的一般想法是如何将用户订阅到一个主题,包含多个设备。我提供了答案,建议使用设备组,然后执行 batchAdd 在服务器端。



但是我想知道是否可以使用设备组 notification_key



订阅主题我还没有看到任何在文档中提到类似的东西。
通知密钥在文档中描述为:


组中的所有设备共享一个共同的通知密钥,这是FCM用于将消息扇出到所有设备group


所以我想也许有可能使用它。但是找不到任何提及它的东西。我查看过任何其他类似帖子的社区,查看了文档,但其中大部分内容仅针对订阅某个主题的单个设备。



是我的回答这个帖子一个好方法?或者我是否错过了已经有一个过程/流程来说明如何实际做到这一点?

我自己并没有真正尝试过它,但它是只有我能想到的方式。我仍在研究GCM& FCM和我会很感激,如果有人以前尝试过,可以解释一下这个问题。

解决方案

您无法订阅device_group到主题。实现这一目标的方法是将与设备组关联的令牌单独或批量订阅到主题。


I've recently encountered this post where the general idea is how to subscribe a user to a topic, with multiple devices. I provided an answer, suggesting to make use of the Device Group, then doing the batchAdd on the server side.

But I was wondering if it was possible to subscribe to a topic using the device group notification_key?

I haven't seen anything that mentions something like that in the docs. The notification key is described in the doc as:

All devices in a group share a common notification key, which is the token that FCM uses to fan out messages to all devices in the group.

So I thought maybe it was possible to use it. But can't find anything that mentions it though. I've looked around the community for any other similar posts, went through the docs, but most of it are just about subscribing a single device to a topic.

Was my answer to the post a good method? Or did I just miss something where there is already a process/flow on how to actually do this?

I haven't really tried it out myself, but it was the only way I could think of. I'm still studying about GCM & FCM and I would appreciate it a lot if someone that tried it before can shed some light about this.

解决方案

You cannot subscribe a device_group to a topic. The way to achieve this would be to subscribe the tokens associated with the device group to the topic either individually or in batch.

这篇关于订阅设备组(notification_key)到主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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