Sending notifications to multiple devices not subs

2019-08-17 03:53发布

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条回答
相关推荐>>
2楼-- · 2019-08-17 04:46

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.

查看更多
登录 后发表回答