Closed danielleontiev closed 1 year ago
Thank you for your bug report. Unfortunately, as you have already identified, this seems to be an issue with your phone hardware and/or your Android flavor. ntfy uses websocket or json stream for instant delivery. If you do not need instant delivery, you can use ntfy.sh with Firebase (default), or sign-up for Firebase yourself and build your own Android app. Beyond that, there is not much I can do for you sadly.
You can join the ntfy Discord/Matrix and see if others have similar experiences with the same phone. But this is certainly not a ntfy bug, because if the battery drain was like this for others, I would have heard about it already.
Good luck.
Is it possible to know (maybe from some API) wether LTE module of the phone is not battery friendly and maybe it's possible to disable instant delivery for such devices or at least print some sort of warning?
Is it possible to know (maybe from some API) wether LTE module of the phone is not battery friendly and maybe it's possible to disable instant delivery for such devices or at least print some sort of warning?
I know this "issue" is old and closed, I understand it's not a bug in ntfy. @danielleontiev do you have any new findings?
@danielleontiev I feel like there's definitely something to it as I'm experiencing same issue with same set of apps. Maybe its related to specific OS/hw(not using same hw/OS as OP)
Is it possible to know (maybe from some API) wether LTE module of the phone is not battery friendly
It would definitely help to pinpoint the issue
Android application drains 5%/hour of battery for my device when using Websocket/Json stream notification method on 4g network. It's not the case for wifi connection
Device: Xiaomi Mi9 SE, lineageOS 20
Screenshot after 5 hours of testing
Here is bugreport.zip that can be used in battery historian.
Not 100% sure but the suspected cause is the permanent waking up of mobile radio:
Some insights
I've seen the discussions on it here https://github.com/binwiederhier/ntfy/commit/23c5d4e34554e69cd457080fa0a385625401d77f here https://github.com/binwiederhier/ntfy/issues/76 and here https://github.com/binwiederhier/ntfy/issues/190 but it seems that the rate of battery drain also depends on the device hardware.
I see the same behavior for Signal messenger (it also uses permanent Websocket connection in the foreground service) and it drains my battery even 3-5 times more than ntfy - there are opened issues in their repository on the topic but the investigation is ongoing as far as I can see.
For me I can see such behavior in ntfy for both Websocket and Json stream mode (the report above is for Websocket mode).
I've tried to compare that to other open source applications and for my device I can see the following:
The reports above is from the clean phone without other apps installed, I've also have not touched it for 5 hours in the row while recording the behavior.