Android Question Firebase notifications during sleep

marcick

Well-Known Member
Licensed User
Longtime User
Many customers are telling me this issue, so I think it is related to some "battery optimization" features in recents Android versions because everything was working fine before.
After a couple of minutes the device is in sleep, it does not receive Firebase notifications. As soon it is waked up, then it shows (I mean notifications are not lost, but just not displayed during sleep).
If I put the device in sleep again it can receive notifications, but after a couple of minutes it stops.
I did another test:
Send a notification to the device (in sleep) and nothing happens.
Send another notification. Nothing happen.
Send a gmail to the device. It wakes up, show the two notification and gmail notification also.

Just for these tests, I'm using the B4J tool to send notification ( a bit adapted to my needings but the core should be the same)

Any ideas ?
 

dcoun

Member
Licensed User
Longtime User
marcick there is an option in the android settings:
Apps & notifications -> 'your app' -> Advanced-Battery->Battery optimization
if your app's tasks are so critical for your clients, ask them to put your app in the list of "not optimized" for battery savings

Probably this will help you in notifications or running as a service. Tell us your experience.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Thank you but looks like the os simply ignore all those settings. I have played around all the options of battery optimisation without success.
 
Upvote 0

dcoun

Member
Licensed User
Longtime User
I do not know if it helps in notifications. In running as a service and keep accurate in time procedures it helps.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
I do not know if it helps in notifications. In running as a service and keep accurate in time procedures it helps.

I think a scheduled service is simple to manage (for the os) using the system clock and wake up the device when needed. But notifications requires a constant connection with a server to be showed in realtime when they are generated. So also if just one app required realtime notification it means that doze mode must be totally excluded.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…