如何使用Firebase云消息传递向所有设备发送通知 [英] How to send notifications to all devices using Firebase Cloud Messaging
问题描述
$ b
{
to:bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1 ...,
数据:{
Nick:Mario,
body:非常棒!,
Room:PortugalVSDenmark
},
}
您无法发送到所有设备。
使用 Firebase Cloud Messaging API 。或者,您可以发送到用户群,特定设备或使用 Firebase通知控制台。
通过Firebase通知,您可以获得最近的,因为有一个默认的用户分段,其中包含安装了特定应用的所有设备。所以,如果你有一个Android和一个iOS应用程序,这将是两个通知。但是没有给这样的观众发送程序化的方式(还)。
On the Firebase doc, it always has a "to" field with a device/token id... but how can I get it to send the notification to all devices. What do I replace the to field with, or what value do I put in there. I'd removed it altogether but it comes back with an error asking for it. Any ideas?
{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"data" : {
"Nick" : "Mario",
"body" : "great match!",
"Room" : "PortugalVSDenmark"
},
}
You cannot send to "all devices".
Instead you can target a specific device, a group of devices or a topic when using the Firebase Cloud Messaging API. Alternatively you can send to a user segment, a specific device, or a topic when using the Firebase Notifications console.
With Firebase Notifications you can get closest, since there is a default user segment that includes all devices that have a specific app installed. So if you have an Android and an iOS app, that would be two notifications. But there's no programmatic way to send to such an audience (yet).
这篇关于如何使用Firebase云消息传递向所有设备发送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!