Sending notifications to multiple devices not subscribed to a certain topic

夙愿已清 提交于 2019-12-12 03:12:40

问题


In a usual Firebase notification scenario, I understand that my apps should subscribe themselves to certain topics that they want to receive notifications for. However, there are cases in which I want to send notifications to specific devices that are not subscribed to a certain topic.

Currently the only way I see of achieving this in Firebase would be to send multiple requests (can easily be a 100+) for each device. Is this the way that this is intended to work or am I missing something?

There is also device groups, but the documentation states that the common use case for this is multiple devices of the same user:

{
   "operation": "create",
   "notification_key_name": "appUser-Chris",
   "registration_ids": ["4", "8", "15", "16", "23", "42"]
}

回答1:


It depends entirely on your use case. If you don't intend to have the registration tokens to have any kind of relationship, the best for you to use is simply the registration_ids parameter where the maximum number of tokens is 1000. Then, as you are currently doing, send batch requests.

For Device Group Messaging, you can create a group, however, if I remember correctly, a notification_id/key has a maximum token of 20.

The least hassle you have is to make use of the Topic Messaging, however, as you already know, you have to subscribe the users first.



来源:https://stackoverflow.com/questions/39771514/sending-notifications-to-multiple-devices-not-subscribed-to-a-certain-topic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!