5

I am using FCM. When mobile screen is ON , Notifications received by all mobiles ( In my case , there is 12 mobiles ) When mobile is locked , Notification send by server successfully but not receive by mobile

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
himali
  • 51
  • 1
  • 6
  • Your application may not designed to get notification at background – Mr.Popular Dec 12 '16 at 06:35
  • http://stackoverflow.com/questions/39756330/android-background-notifications-with-firebase-cloud-messaging-not-received Maybe this will help you – Pwnstar Dec 12 '16 at 06:40
  • Check if this helps. http://stackoverflow.com/a/38795553/1840795 – Nakul Sudhakar Dec 12 '16 at 06:40
  • No , background scenario is work perfectly...Thanks for helping... I have got the soluation...In Server It should be "delayWhileIdle(false)" instead of "delayWhileIdle(true)" – himali Dec 12 '16 at 10:44
  • Hey @himali Thank you very much for this solution, you saved me a lot of time, I was going crazy because I did not find the right solution: D. – Mahmoud May 06 '22 at 17:55

1 Answers1

0

Add this Permission in manifest which prevents your phone from sleeping.

<uses-permission android:name="android.permission.WAKE_LOCK"/>

also check in latest device their is concept of protected apps only protected app will run in background only these apps will receive notification when device is locked

In protected apps located in Advanced settings->Battery manager->protected aps

Anil
  • 1,605
  • 1
  • 14
  • 24
  • 1
    I have add this permission already in manifest...Thanks for helping... I have got the soluation...In Server It should be "delayWhileIdle(false)" instead of "delayWhileIdle(true)" – himali Dec 12 '16 at 10:44
  • In server means? – nilesh prajapati Sep 18 '18 at 06:46
  • @himali I'd like to know how you fixed it. – Hassan Ansari Dec 28 '20 at 13:15
  • The delay_while_idle key specifies if you want to send the push message when the device is idle. By setting the key to true, the push message will not be delivered to the device until the device becomes active. so while creating a notification using this in payload `{"delay_while_idle": false}` – Raza Ellahi Feb 13 '22 at 13:29