firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.26k stars 573 forks source link

I can't receive FCM push messages when my phone locks the screen for more than 30 minutes #4317

Closed warrenToday closed 1 year ago

warrenToday commented 1 year ago

I integrate firebase. When my application is in the foreground, background or directly killed, I can normally receive push messages. When I kill the application, I can also receive push messages within 20 minutes of locking the screen. But 30 minutes after locking the screen, I can no longer receive messages until I unlock the phone screen.

I have three mobile phones, Pixel2, Pixel4 and Galaxy Note 10+. Their systems are Android11 and Android12. These three mobile phones all have the same problem. After the screen is locked for 30 minutes, no push mes

google-oss-bot commented 1 year ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

argzdev commented 1 year ago

Hi @warrenToday, thanks for reporting. I think the issue you might be experiencing is due to the priority level of the message. Could you try setting it up using our docs here, it should be something like this:

{
  "message":{
    "topic":"subscriber-updates",
    "notification":{
      "body" : "This week's edition is now available.",
      "title" : "NewsMagazine.com",
    },
    "data" : {
      "volume" : "3.21.15",
      "contents" : "http://www.news-magazine.com/world-week/21659772"
    },
    "android":{
      "priority":"normal"
    },
    "apns":{
      "headers":{
        "apns-priority":"5"
      }
    },
    "webpush": {
      "headers": {
        "Urgency": "high"
      }
    }
  }
}

Let me know if this works. Thanks.

warrenToday commented 1 year ago

Hi @warrenToday, thanks for reporting. I think the issue you might be experiencing is due to the priority level of the message. Could you try setting it up using our docs here, it should be something like this:

{
  "message":{
    "topic":"subscriber-updates",
    "notification":{
      "body" : "This week's edition is now available.",
      "title" : "NewsMagazine.com",
    },
    "data" : {
      "volume" : "3.21.15",
      "contents" : "http://www.news-magazine.com/world-week/21659772"
    },
    "android":{
      "priority":"normal"
    },
    "apns":{
      "headers":{
        "apns-priority":"5"
      }
    },
    "webpush": {
      "headers": {
        "Urgency": "high"
      }
    }
  }
}

Let me know if this works. Thanks.

The push data can be received normally after being added to high priority. Thank you for your support

argzdev commented 1 year ago

Awesome, I'm glad to hear that works for you. I'll close this issue now. Thanks!