问题
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:
- Topic A && !Topic B && !Topic C
- Topic B && !Topic C
- 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