更新时间:2022-11-03 22:40:41
正如 Frank van Puffelen 所说,没有办法发送到所有设备.您可以使用以下方式在应用程序端为每个人订阅一个主题:
As Frank van Puffelen said there isn't a way to send to all devices. What you could do is to subscribe everyone to a single topic in the app side using:
FirebaseMessaging.getInstance().subscribeToTopic("TopicName");
所以你的信息应该是这样的:
So your message would look like this:
{
"to" : "/topics/TopicName",
"data" : {
"Nick" : "Mario",
"body" : "great match!",
"Room" : "PortugalVSDenmark"
},
}
主题是在 Firebase 服务器端自动创建的,但有时需要一段时间才能显示在 Firebase 下拉列表中.
The topic is automatically created in the Firebase server side, but sometimes it takes a while to show up in the Firebase drop down list.
单个主题的用户数不限.
The number of users in a single topic are unlimited.