Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery draining on android #7663

Open
Maxence-v opened this issue Dec 13, 2020 · 109 comments
Open

Battery draining on android #7663

Maxence-v opened this issue Dec 13, 2020 · 109 comments

Comments

@Maxence-v
Copy link

Battery is completely drained on android, I'd like to send a screenshot of my stats on my samsung

Steps to reproduce

Expected behaviour

Tell us what should happen

Actual behaviour

Tell us what happens instead

Server configuration

Operating system:

Web server:

Database:

PHP version:

Nextcloud version: (see Nextcloud admin page)

Contacts version: (see Nextcloud apps page)

Updated from an older Nextcloud or fresh install:

Signing status:

Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Nextcloud configuration:

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your instance's installation folder

or

Insert your config.php content here
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

CardDAV-clients:

Logs

Web server error log

Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Insert your Nextcloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...
@skjnldsv
Copy link
Member

Hi, sorry, but what does it have to do with contacts?

@Maxence-v
Copy link
Author

Maxence-v commented Dec 14, 2020

Oops sorry no idea, but my phone (s20 plus) is showing huge amount of battery used by the nextcloud app, I disabled battery optimization in android because I use auto upload, and I'm not uploading 24/7 so I don't understand the battery drained
A friend of mine has a s20 plus too and he doesn't have this problem
Screenshot_20201214-150050_Device care

@skjnldsv
Copy link
Member

Moving to the android repo

@skjnldsv skjnldsv transferred this issue from nextcloud/contacts Dec 14, 2020
@skjnldsv skjnldsv added bug needs info Waiting for info from user(s). Issues with this label will auto-stale. labels Dec 14, 2020
@Maxence-v
Copy link
Author

So no idea?

@tobiasKaminsky
Copy link
Member

what device do you have?
Have you enabled auto sync?

@Maxence-v
Copy link
Author

Samsung s20 plus, before I had the Samsung note 10 plus, and I had the same problem.

Yes I have the "auto upload" feature activated

@ezaquarii
Copy link
Collaborator

Can you check logs on the server to see if you get a lot of PROPFIND requests coming from the device every 15 minutes? :)

@yawicz
Copy link

yawicz commented Feb 4, 2021

@ezaquarii, I do actually observe exactly the behaviour you describe with two different Android phones having two different user accounts, yes.
I found those entries in the logs of my nginx server running Nextcloud and was wondering whether this should be expected/desired behaviour or not.
Do you have an idea what's going on with those random directory, but very regular PROPFIND commands?
On both phones, the app is completely closed (not stopped via the app settings, but closed from task manager) and auto upload is deactivated.

@ezaquarii
Copy link
Collaborator

@yawicz I don't know exactly - as I'm not expert on files sync component - but I can only speculate that it polls the server for changes. I'd additionally check the interval - if it's 15 minutes, that would correlate with default background task wakeup.

One option is to turn on battery optimization for that app - it should stop OS from waking the app and giving it network access frivolously.

Is this expected? Yes, because sync is implemented using polling.
Desired - hell no, but the fix is not trivial, to say the least.

@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the stale label Mar 5, 2021
@jeffWelling
Copy link

I hope this doesn't get closed because of inactivity, it's a real problem for android users, I'd be happy to help poke at this if there's more info that I can provide?

Maybe instead of just checking every 15 minutes, we could let the user configure this setting? I would be quite happy with a nightly upload, I don't need my phone to check every 15 minutes. I also understand the desire to avoid options overload as mentioned in another Issue comment, but IMO this warrants a user configurable option of some sort.

@jeffWelling
Copy link

I'm currently seeing this battery consumption issue.

Android Samsung model SM-G965W
Android 10
NextCloud App 3.15.1

AutoUpload is enabled, but has caught up with everything needing to be uploaded.

@tobiasKaminsky
Copy link
Member

Do you know how many files/images you have on your device?
It scans and compares them to find those needed for upload.

@LSchober
Copy link

I have the same problem of high battery drain.

Google Pixel 4a 5G
Android 11
NextCloud App 3.15.1 (F-Droid-Build)
NextCloudPi 20.0.8
~30GB videos & photos

AutoUpload is enabled, but has caught up with everything needing to be uploaded.

@github-actions github-actions bot removed the stale label Mar 15, 2021
@jeffWelling
Copy link

Do you know how many files/images you have on your device?

~15K photos and videos for me, totaling about 60GB.

It scans and compares them to find those needed for upload.

Understandable, but it seems the default value perhaps doesn't work for people with large existing camera rolls, one solution here may be to just let the user configure the app to only check nightly, instead of continuously. Is there any chance such a feature could be implemented, perhaps with a simple checkbox in Settings?

Also open to alternative solutions, maybe just let the user decide how often to check?

Even with working from home, having the app drain battery this fast is a big obstacle for getting the rest of the family to adopt NextCloud, so I'd like to help get this fixed any way I can :)

@tobiasKaminsky
Copy link
Member

@jeffWelling are all files uploaded?
I currently fear that pending uploads is more draining battery than auto upload does.

@Maxence-v
Copy link
Author

I thought the problem came from a large amount of files too. I had 20k files for 185GO, but then i reduced the files to 3k and i have still the same problem....

@jeffWelling
Copy link

In my situation, all files are eventually uploaded yes.

@tobiasKaminsky That makes a lot of sense actually.
The last few days I'll take a photo of something in the morning to send to someone (garden growth), and it queues for upload but has to wait for me to charge the phone because that's what I config'd, and Android frequently asks me if I'll let it put the app to sleep because of how much battery it's using. I'll try resisting taking pics to see if the battery usage is different with nothing pending an upload, good thought!

@LSchober
Copy link

LSchober commented Apr 1, 2021

Can i provide any additional information to solve this problem?

Maybe instead of just checking every 15 minutes, we could let the user configure this setting? I would be quite happy with a nightly upload, I don't need my phone to check every 15 minutes.

@jeffWelling i really like your solution with making this configurable!

A crontab like config would be great :)

@geistchevalier
Copy link

I would also like to put my vote behind having a user configurable sync frequency + a sync now button.
For my case, I only sync a few critical files to my phone (less than 5MB) that rarely gets updated, but the battery is draining faster than before I installed the app.

Google Pixel 4a
Android 11
NextCloud App 3.15.1 from Google's play store
a self hosted Nextcloud 21.0.0 server

@MikeZuluUSA
Copy link

MikeZuluUSA commented Apr 3, 2021

Hi,
I have been observing a heavy drainage since a couple days.
Samsung S9 - Android - April Update
Nextcloud Version 3.15.1
4 Auto Upload Folders

Haven't had the problem that extreme.
Only a couple auto uploads a day.
Up to 85% consuming battery!!!!! (See the screenshot)!
No pending uploads.

tempFileForShare_20210403-171953

@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the stale label May 1, 2021
@Zorks
Copy link

Zorks commented May 2, 2021

this is definitely not a stale issue and is an ongoing problem for android users.

Samsung Galaxy Note 8
Android 9
Nextcloud App 3.15.1
Nextcloud Server 20.0.3

Used to be able to leave my phone off the charger overnight and only lose 5% or so battery life. Ever since enabling auto upload, I've seen extreme battery drain from the Nextcloud app and an extremely reduced battery time for my phone.

@pinni83
Copy link

pinni83 commented Dec 4, 2022

I have this issue since 3.22.3 (also on 3.23.0). But not always. Auto-Upload + WiFi endabled. It seems when I Take a picture (which should bei uploaded) and I don't have WiFi, the app stays active and drains battery until WiFi ist available and pictures are uploaded.

@TimGitHoub
Copy link

Same issue here on Galaxy S21. Android version 13. Nextcloud version 3.23.0.
The battery useage of NC is at about 18% although I'm not synchronizing or working with Nextcloud. Upload is activated when phone is in wifi and charging.

@AlvaroBrey
Copy link
Member

These latest reports should be fixed by #11124 , which will be out in 3.23.1

@dschoerk
Copy link

These latest reports should be fixed by #11124 , which will be out in 3.23.1

thank you so much for working on this!

@okkine
Copy link

okkine commented Dec 16, 2022

I'm experiencing the same problem. NEXTCLOUD is draining 20-25% of the battery ever since I disabled battery optimization, despite not having a lot to sync.

@mlietze
Copy link

mlietze commented Dec 27, 2022

Fix works for me very well!! Thank you so much!

@Ra72xx
Copy link

Ra72xx commented Dec 30, 2022

On which version should this fix be enabled? I tried 3.23.1 and is as bad as ever. Moreover, somehow I now cannot Nextcloud get back to normal battery usage even when disabling auto upload and enabling battery optimization.

@dmalanij
Copy link

dmalanij commented Jan 8, 2023

Seems better with 3.23.1. Will keep an eye on it, so far looks battery consumption has reduced significantly.

@gabooh
Copy link

gabooh commented Jan 13, 2023

Same issue here on Galaxy S21. Android version 13. Nextcloud version 3.23.0. The battery useage of NC is at about 18% although I'm not synchronizing or working with Nextcloud. Upload is activated when phone is in wifi and charging.

Same problem, S21 ultra, app version and battery usage is very high, sometimes around 30%. Auto upload is enabled on wifi and on charge only. This is so bad I will have to disable the feature.

@okkine
Copy link

okkine commented Jan 13, 2023

Mine's been really good since the update. Thanks!

@mhzawadi
Copy link

update: I still get issues with high battery use, nextcloud is the 4th on my list of top battery use. But I dont open the app very often as it uploads without needing to open. screenshot from today.

Screenshot_2023-01-15-10-14-56-13_0ba066473b79d6e213a1f6f52505e2ee

@Nocturna22
Copy link

Nocturna22 commented Jan 19, 2023

Short version:
Android app version: 3.23.1
Nextcloudversion: 25.0.3
App runtime: ~1 day
Last charge: ~11 hours ago
Consumed power: 977 mAh (21%)

Long version:
Hello, I have a similar problem. The Nextcloudapp has been running for about 1 day and has used 977 mAh. I'm not familiar with apps and don't know how much they should consume, but 977 mAh is 21% of the total consumption. I guess that the consumption resets when charging. Now it's evening and the last charge was about 11 hours ago. I think the consumption is too high.

Thanks for the great work :)

Edit:

If the app only syncs when you load, then only the wifi query should be active. This should not drain the battery so much... I will test this.

@Kathou99
Copy link

Hi I still got 20% of usage of my batteryScreenshot_20230124-183442_Device care.jpg

@BLu85
Copy link

BLu85 commented Jan 31, 2023

Hi All,

Unfortunately I am still experiencing this problem.
Nextcloud App: 3.23.1
Nextcloud server: 25.0.3 running Apache

I noticed that the app gets stuck with the blue wheel constantly spinning when trying to load files in a folder with a lot (~5 k) of files. This folder is also set for automatic updates when WiFi is on and phone pluged in.
When phone is unplugged Nextcloud picks the battery usage up to 40%.
Could the amount of files to load be one of the cause of this behaviour?

Thanks for the amazing job you guys do.
Luca

@Ra72xx
Copy link

Ra72xx commented Feb 2, 2023

For me there are two factors for the battery drain:

  1. What constantly gives me massive battery drain is having automatic upload enabled. This I have disabled and use other software for this functionality.
  2. Moreover, there is also a sync adapter for Nextcloud. When this is enabled, I experience battery drain very often (but not always) despite having restricted background actitivity for the app. I also see that this sync adapter runs very long if started manually and often does not finish.

My question is: What does the sync adapter do, and what functionality do I lose if I disable it? I use the Nextcloud app as an Android storage provider, can it happen that storage provider and cloud storage get out of sync? Or does it only mean that changes on the cloud are not synced immidiatedly to the phone but only on access?

@schiessle
Copy link
Member

I'm facing the same issue.

Yesterday it used 7.1%, today even 10.6% of my battery usage. Both times it was the app with the most battery usage athough I didn't used the app at all. I also didn't took any pictures, so no instant upload happened.

As you can see here, it is all background usage:

image

I have the app connected to two Nextcloud servers (my personal one and my work instance). On the work instance a lot of stuff is happening during working ours. So I could imagine that the app checks constantly what changed because the etag of the root changes probably every few minutes.

@dromatriptan
Copy link

dromatriptan commented Mar 15, 2023

Screenshot_20230315-071528_Settings

Suffering same issue. MOTOROLA Edge (2020) running LineageOS 20 and Next loud 3.24 from F-Droid repository. Battery usage hovers around 14% and 4000mah battery goes within a day and app is idle.

Oddly enough, I was not having this issue on Android 11 when I initially started considering next cloud as my Microsoft Office 365/OneDrive replacement. Now that I'm on, essentially, Android 13 the phone goes from a 3-day battery run time to > 1-day.

@OlJohnny
Copy link

OlJohnny commented Mar 30, 2023

adding another bump

Also having this issue with all photos uploaded and only set to on wifi + charging.

Why can't the loop checking if photos need to be uploaded just be run when the wifi + charging requirements are met? Then the whole app could just be idling and not require any amount of battery charge!

@storm1er
Copy link

storm1er commented Jun 1, 2023

using 3.25.0 RC1 on a fresh new phone, android 13, honor magic vs => 21 min background consumed ~35% battery ...

Previously (last days) I was using my oneplus 6 on the latest lineageOS, 3.25.0 also, no issue whatsoever :/

@trostn
Copy link

trostn commented Feb 12, 2024

I have the same problem. Please don't forget about it.
The suggested option to have the app just syncing over night or in a configurable schedule would be really nice and could also be a solution to this problem.

@TheOneOgre
Copy link

Please add a scheduled upload or only at night or something along those lines. Even if it's not a permanent fix, it's a damn good workaround and as an option shouldn't hurt anything

@tperka-catalogicsoftware

Still the same problem on 3.29.0 version running on Pixel 6. Enormous battery usage. Why can't we select auto-sync daily just like in case of contacts and calendar?

@etilamine
Copy link

I'm having the same problem. Huge battery drain and "Preparing auto-upload" notification present every few minutes. I'm on Lineage OS 20.

@lckarssen
Copy link

Same problem here with Nextcloud client being listed as the app that consumes most battery, as well as the frequent "Preparing auto-upload". This is on a Samsung S22, Nextcloud client v3.29.2, with 3 accounts to 3 different servers (all 29.x.x), but only one account has auto-upload enabled.

#12141 is probably related/duplicate. For me this has been a problem since roughly September 2023, when I created #11983.

@Mattie112
Copy link

Since a couple of weeks I have the same indeed. It has been good for a long time for me but now lots of "preparing auto-uploads" (even when no picture / screenshot was taken). Battery is worse that it was.

@joshtrichards
Copy link
Member

Related: #13008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests