FCM (Bug) - Send a notification to multiple topics

2019-08-17 18:26发布

问题:

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.