mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #687] android: excessive battery drain on 4g network #506
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#506
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danielleontiev on GitHub (Mar 27, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/687
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
github.com/binwiederhier/ntfy@23c5d4e345here 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:
github.com/vector-im/element-android@716bd9a2e6/vector-app/src/fdroid/java/im/vector/app/fdroid/BackgroundSyncStarter.kt (L47-L52))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.
@binwiederhier commented on GitHub (Mar 31, 2023):
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.
@danielleontiev commented on GitHub (Mar 31, 2023):
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?
@Finn10111 commented on GitHub (Jul 5, 2024):
I know this "issue" is old and closed, I understand it's not a bug in ntfy. @danielleontiev do you have any new findings?
@jayb-g commented on GitHub (Oct 23, 2024):
@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)
@jayb-g commented on GitHub (Oct 25, 2024):
It would definitely help to pinpoint the issue
@jayb-g commented on GitHub (Feb 19, 2025):
Isn't firebase too, made for instant delivery ?
Is it known/tested to use (almost) same amount of battery in GMS vs non-GMS Androids?