Firebase API with multiple themes in state

I encountered a tragic problem when calling the FCM API: In short When I call the API with the following:

URL:-https://fcm.googleapis.com/fcm/send Content-Type:application/json Authorization:key=AAAA4Kkj8iw:APA91bE......vE4Hxg { "condition" : "'Software' in topics", "data":{ "title":"Title", "message":"Hello,Via Multiple Topics" } } 

It works Well, and I received a notification on the device from which I subscribed to the topic "Software", but when I switch to several topics and change the body to

 { "condition" : "'Software' in topics || 'IOT' in topics", "data":{ "title":"Title", "message":"Hello,Via Multiple Topics" } } 

then I do not receive a notification I tested it on POSTMAN, it shows that a message has been sent, but I do not receive a notification on my device.

+5
source share
1 answer

This is the correct way according to the Firebase Documentation :

Subject HTTP POST request

Submit to topic:

 https://fcm.googleapis.com/fcm/send Content-Type:application/json Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA { "to": "/topics/foo-bar", "data": { "message": "This is a Firebase Cloud Messaging Topic Message!", } } 

Send to devices that subscribe to dog or cat themes:

 https://fcm.googleapis.com/fcm/send Content-Type:application/json Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA { "condition": "'dogs' in topics || 'cats' in topics", "data": { "message": "This is a Firebase Cloud Messaging Topic Message!", } } 
0
source

Source: https://habr.com/ru/post/1263188/


All Articles