Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Negation in condition while sending FCM message

I am subscribing to a topic which is my application version in Android.

FirebaseMessaging.getInstance().subscribeToTopic(APP_VERSION);

Now every time I launch an update, I have to unsubscribe to an old version and subscribe to a new version so if I send an update notification only old users will get it. Instead, it would be great if I just negate a version.

"condition": "!'2.1.1' in topics",

Is something like this exists in FCM?

like image 228
mihirjoshi Avatar asked Sep 01 '16 16:09

mihirjoshi


1 Answers

It looks like Firebase supports this now! Firebase send-message

You can include up to five topics in your conditional expression, and parentheses are supported. Supported operators: &&, ||, !. Note the usage for !:

!('TopicA' in topics)

With this expression, any app instances that are not subscribed to TopicA, including app instances that are not subscribed to any topic, receive the message.

like image 154
julo Avatar answered Oct 04 '22 08:10

julo