firebase消息传递条件无效的论点

发布于 2025-02-10 02:07:33 字数 849 浏览 0 评论 0原文

我使用Firebase将通知发送给已订阅特定主题的多个设备。

要将通知发送到主题的组合,我使用以下“条件”:

String condition = "'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics || 'TopicD' in topics || 'TopicE' in topics) && ('TopicF' in topics || 'TopicG' in topics)"
Message message = Message.builder()
.setNotification(Notification.builder()
    .setTitle("notificationTitle")
    .setBody("notification body bla bla")
    .build())
.setCondition(condition)
firebaseService.send(message)

如果条件仅包含5个主题,则可以正常工作,否则我会遇到错误:

HTTP Error: 400, Request contains an invalid argument.

据我了解,这是FCM中的一个错误,这仍然不是解决了

我在这里找到了一个解决方法: https://stackoverflow.com/a/52302136/47774302 条件为多种条件。

是否有一种自动化的方法将条件分成一组5人,并最少提出壁炉请求?

I use Firebase to send notifications to multiple devices that have subscribed to a particular topic.

To send a notification to a combination of topics, I use "conditions" as described below:

String condition = "'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics || 'TopicD' in topics || 'TopicE' in topics) && ('TopicF' in topics || 'TopicG' in topics)"
Message message = Message.builder()
.setNotification(Notification.builder()
    .setTitle("notificationTitle")
    .setBody("notification body bla bla")
    .build())
.setCondition(condition)
firebaseService.send(message)

This works fine if the condition contains only 5 topics, otherwise I get an error:

HTTP Error: 400, Request contains an invalid argument.

as I understand it is a bug in FCM, which is still not resolved

I found a workaround here : https://stackoverflow.com/a/52302136/4774302, which consists in breaking a condition into several conditions.

Is there an automated way to break the condition into a group of 5, with a minimum of firebase requests ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文