在 android 内发送 FCM,没有主题和限制

Send FCM in android without topics and limits

我有一个集成了用于推送通知的 Firebase 云消息传递的应用程序。 我很早以前就集成了它,但是我已经更新了依赖项。

我的问题是用户在订阅主题后会收到通知,例如:

FirebaseMessaging.getInstance().subscribeToTopic("races");

//… And send push

{
  "to": "/topics/races",
  "data": {
    "title" : "New Race",
    "text": "Race Lorem Ipsum2",
    "tag": "march",
    "media": "si",
    "footer": "race 2343"
   }
}

我真的不希望有任何话题,所有用户都可以随时收到通知

这可能吗?

我还注意到有几个用户收到了通知,而另一个没有。投稿有什么限制吗?

我在这个页面上找到了这个:

"The topic subscription add/remove rate is limited to 3,000 QPS per project."

我的应用程序有 3,000 多个用户,删除主题是否值得让所有用户都收到?

除此之外,如果有人知道一个很好的教程,一步一步地描述 Android 中的实现,这对我来说将非常有用,官方文档我已经丢失了好几次。

notifications are meant to be received by all users at all times. Is this possible?

没有"send to everyone"选项。定位用户的唯一方法是:按主题和实例 ID/FCM 令牌。

覆盖所有人的最简单方法是为此设置一个 "all" 主题。

I've also noticed that several users get the notification and another one doesn't. Is there any kind of limitation in the submissions?

存在(已记录的)限制,但设备未收到通知的最可能原因是设备未在 Google/FCM 服务器上登记。我强烈建议阅读 Understanding message delivery 并使用从那里链接的资源。

"The topic subscription add/remove rate is limited to 3,000 QPS per project."

这意味着您每秒最多只能向主题添加新用户(或删除用户)3,000 次。您达到此限制的可能性非常

推荐站外资源在Stack Overflow上是题外话,不过我几年前写过一篇入门教程:Sending notifications between Android devices with Firebase Database and Cloud Messaging.