为设备组 (notification_key) 订阅主题

Subscribe a Device Group (notification_key) to a Topic

我最近在服务器端遇到了这个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

但我想知道是否可以使用设备组 notification_key 订阅主题?

我没有在文档中看到任何提到类似内容的内容。 通知键在doc中描述为:

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.

所以我想也许可以使用它。但是找不到任何提到它的东西。我在社区中寻找任何其他类似的 posts,浏览了文档,但其中大部分只是关于将单个设备订阅一个主题。

我对 post 的回答是个好方法吗?或者我只是错过了一些关于如何实际执行此操作的 process/flow?

我自己还没有真正尝试过,但这是我能想到的唯一方法。我仍在研究 GCM 和 FCM,如果以前尝试过的人能对此有所了解,我将不胜感激。

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