appleboy / gorush

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

Silent notifications on iOS not working #567

Open qwertycommander opened 3 years ago

qwertycommander commented 3 years ago

It seems that silent notifications are not working for me on iOS.

I followed Apple's instruction by only providing an APNS payload of content-available, but they don't seem to get delivered.

438 seems to have the same issue with no fix. When I provide a title, the APN gets delivered, but when it's omitted, it does not.

#438

keremoge commented 3 years ago

I tried following request and you can check the APNS request below. Can you share your gorush and APNS request?

request going gorush:

{
  "notifications": [
    {
      "platform": 1,
      "priority": "high",
      "tokens": [
        "**********4wAABp_BOYhKWWMLfSF9GV52UO_rYvBoKbQuuuI6HWSfLdG7_t-ZhA2_Zg47BpQbzBegmHUxovPTp3rU0xajPAfnz9IkOb**********"
      ],
      "content_available": true,
      "category": "CONFIRM",
      "sound": {
        "critical": 1,
        "name": "default",
        "volume": 1
      },
      "alert": {
        "body": "iOS UAT başarılı bildirim geldi"
      },
      "data": {
        "customerNo": 12345,
        "languageCode": "tr",
        "specificCharText": "denemee"
      }
    }
  ]
}

request going APNS:

{
  "aps": {
    "alert": {
      "body": "iOS UAT başarılı bildirim geldi"
    },
    "category": "CONFIRM",
    "content-available": 1,
    "sound": {
      "critical": 1,
      "name": "default",
      "volume": 1
    }
  },
  "customerNo": 12345,
  "languageCode": "tr",
  "specificCharText": "denemee"
}
boma-digital commented 1 year ago

Hey @qwertycommander - I know this is some years old now but did you ever manage to find a payload that delivered silent messages to iOS devices reliably? Thanks!

obuzyig commented 2 weeks ago

Hello everyone, I think it can be possible to manage background notifications with such kind of a payload, if application arranged for the related settings. There is not any text to be shown in the payload as the message. It can also be managed with the data elements in the list. (For instance, "xyz": "true" can be handled on the client side.) This are not fully required or mandatory fields, of course.

{
  "notifications": [
    {
      "tokens": [
        "Token"
      ],
      "platform": 1,
      "topic": "TOPIC_INFO",
      "push_type": "background",
      "content_available": true,
      "notif_id": "12345",
      "data": {
        "bkg": "true",
        "notif_id": "12345"
      }
    }
  ]
}