如何使用v1 API将FCM通知发送到特定设备令牌的列表 [英] How to send FCM Notification to a list of specific device tokens using the v1 API
问题描述
我想使用新的FCM HTTP v1 API,在此记录 FCM HTTP v1 API文档,以将通知发送给一次使用多个设备,但不使用使用主题或组(例如,我想向10个随机抽奖的中奖者发送通知).我知道在以前的版本中(旧版FCM HTTP协议) ,这可以通过使用 registration_ids 参数来实现,但在当前的API中看不到任何相似之处.我想念什么吗?有没有不使用旧版API的方法?
I want to use the new FCM HTTP v1 API, which is documented here FCM HTTP v1 API Documentation, to send a notification to multiple devices at once, but without using topics, or groups (let's say I want to send a notification to 10 random winners of some lottery). I know that in the previous version (Legacy FCM HTTP Protocol), this was possible by using the registration_ids parameter, but I don't see anything similar in the current API. Am I missing something? Is there a way to do this without using the legacy API?
推荐答案
除了对FCM v1使用主题外,目前没有其他方法可以发送到多个令牌.
There is currently no other way to send to multiple tokens besides using topics for FCM v1.
在您提到的用例中,如果我使用的是v1,则可能会选择类似以下内容:选择获胜的令牌后,将它们订阅为winningTokens<date_here>
之类的主题,然后发送消息.
In your mentioned use case, if I'm using v1, I would probably go at something like, after selecting the winning tokens, you subscribe them to a topic like winningTokens<date_here>
then send the message.
这篇关于如何使用v1 API将FCM通知发送到特定设备令牌的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!