appleboy / gorush

A push notification server written in Go (Golang).
MIT License
8.01k stars 841 forks source link

Sending data to topics does not work #816

Open genna87 opened 2 weeks ago

genna87 commented 2 weeks ago

Trying to send a notification to Android apps.

Using topics, the data field is not populated, using a list of tokens data is populated as expected. In both cases the expected devices get the notification, but using topic the function com.google.firebase.messaging.RemoteMessage getData() returns null.

Here you can find two sample payloads:

{
  "notifications": [
    {
      "topic": "mytopic",
      "platform": 2,
      "time_to_live": 360,
      "data": {
        "key1": "val1",
        "key2": "val2",
        "key3": "val3"
      }
    }
  ]
}
{
  "notifications": [
    {
      "tokens": ["mytoken"],
      "platform": 2,
      "time_to_live": 360,
      "data": {
        "key1": "val1",
        "key2": "val2",
        "key3": "val3"
      }
    }
  ]
}

THANKS!

genna87 commented 1 week ago

The only one here with this problem?