Reputation: 195
I am facing a tragic issue while calling FCM API:- In brief When I am calling the API with 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 Fine and I got the notification on device from which I have subscribed to topic "Software", But when I go for multiple topics and change the body to
{
"condition" : "'Software' in topics || 'IOT' in topics",
"data":{
"title":"Title",
"message":"Hello,Via Multiple Topics"
}
}
then I don't get the notification I have tested it on POSTMAN it shows that message was sent but I don't receive any notification on my device.
Upvotes: 7
Views: 3817
Reputation: 12031
This is the right way as per the Firebase Documentation:
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!",
}
}
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!",
}
}
Upvotes: 3