具有多个主题的Firebase API调用

Nil*_*Nil 5 android firebase google-cloud-messaging firebase-cloud-messaging

在调用FCM API时我遇到了一个悲剧性的问题: - 简而言之当我使用以下方法调用API时:

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"
    }
}
Run Code Online (Sandbox Code Playgroud)

它工作正常,我在设备上收到了通知,我订阅了主题"软件",但是当我选择多个主题并将主体更改为

{
    "condition" : "'Software' in topics || 'IOT' in topics",
    "data":{
        "title":"Title",
        "message":"Hello,Via Multiple Topics"
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我没有收到我在POSTMAN上测试过的通知,它显示已发送消息,但我的设备上没有收到任何通知.

Dar*_*ush 3

根据Firebase 文档,这是正确的方法:

主题 HTTP POST 请求

发送到单个主题:

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!",
   }
}
Run Code Online (Sandbox Code Playgroud)

发送到订阅主题“狗”或“猫”的设备:

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!",
   }
}
Run Code Online (Sandbox Code Playgroud)