FCM (Bug) - Send a notification to multiple topics without using the OR operator.

雨燕双飞 提交于 2019-12-13 03:18:59

问题


Apparently, After having an issue with the (OR ||) operator, As the notification was received when i used the (AND &&) operator and it wasnt when i used (OR ||).

Google confirmed that the OR operator is not working currently in FCM condition field :

So is there another way i could send a notification to those who are subscribed to ( TopicA or TopicB or TopicC ) without the (OR ||) operator?


回答1:


Update - So ive contacted FCM support & they helped me with a workaround using the (AND &&) And (NOT !) Operators :

For example, you're trying to send a message to Topic A OR Topic B OR Topic C.

This condition can be converted to the suggested workaround by sending 3 messages which looks something like:

  1. Topic A && !Topic B && !Topic C
  2. Topic B && !Topic C
  3. Topic C

Only partial solution i have found so far is to make the condition this way :

"'TopicNone' in topics && ('TopicA' in topics || 'TopicB' in topics)"

With TopicNone a topic that all devices are subscribed to. Apparently if i used the OR(||) operators after the AND(&&) operator. It works.

Hoping for google to fixe this bug soon.



来源:https://stackoverflow.com/questions/48627928/fcm-bug-send-a-notification-to-multiple-topics-without-using-the-or-operator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!