android icon indicating copy to clipboard operation
android copied to clipboard

Battery draining on android

Open kinorai opened this issue 4 years ago • 108 comments

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) ...

kinorai avatar Dec 13 '20 00:12 kinorai

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

skjnldsv avatar Dec 13 '20 14:12 skjnldsv

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

kinorai avatar Dec 14 '20 14:12 kinorai

Moving to the android repo

skjnldsv avatar Dec 14 '20 14:12 skjnldsv

So no idea?

kinorai avatar Dec 16 '20 01:12 kinorai

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

tobiasKaminsky avatar Dec 18 '20 06:12 tobiasKaminsky

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

kinorai avatar Dec 18 '20 13:12 kinorai

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

ezaquarii avatar Dec 18 '20 22:12 ezaquarii

@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.

yawicz avatar Feb 04 '21 23:02 yawicz

@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.

ezaquarii avatar Feb 05 '21 00:02 ezaquarii

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

github-actions[bot] avatar Mar 05 '21 00:03 github-actions[bot]

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 avatar Mar 14 '21 22:03 jeffWelling

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.

jeffWelling avatar Mar 14 '21 22:03 jeffWelling

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

tobiasKaminsky avatar Mar 15 '21 08:03 tobiasKaminsky

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.

LSchober avatar Mar 15 '21 20:03 LSchober

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 :)

jeffWelling avatar Mar 16 '21 00:03 jeffWelling

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

tobiasKaminsky avatar Mar 16 '21 07:03 tobiasKaminsky

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....

kinorai avatar Mar 16 '21 12:03 kinorai

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!

jeffWelling avatar Mar 19 '21 07:03 jeffWelling

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 :)

LSchober avatar Apr 01 '21 07:04 LSchober

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

geistchevalier avatar Apr 01 '21 08:04 geistchevalier

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

MikeZuluUSA avatar Apr 03 '21 21:04 MikeZuluUSA

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

github-actions[bot] avatar May 01 '21 22:05 github-actions[bot]

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.

Zorks avatar May 02 '21 15:05 Zorks

I found a workaround which isn't ideal but it's the best I got. I enabled battery optimization for the nextcloud app and time to time I launch the app to start the upload. So nextcloud isn't draining battery in the background.

kinorai avatar May 02 '21 15:05 kinorai

Best fix by nextcloud team would be :

  • possibility to put a custom time instead of checking every 15 min
  • add a condition to scan only if the phone is charging

kinorai avatar May 02 '21 15:05 kinorai

I am observing same battery drain as other users. I think, it is connected to auto-update mechanism. I've made all four synchronized folders to upload only when the phone is on charger. It has indeed prevented uploads themselves to happen, but the application regularly checks all the files whether there is anything to upload (even though all folder are configured to not upload on battery) - at the end it never uploads anything when on battery. Configuration option, which would make the Nextcloud check for new files only on charge would probably solve my issues.

mgubis avatar May 06 '21 07:05 mgubis

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

github-actions[bot] avatar Jun 10 '21 08:06 github-actions[bot]

I see there is no activity on this issue and it is about to be closed in 2 weeks. The problem is still there - would it be possible to offer configuration to prevent Nextcloud background operations when not connected to charger?

mgubis avatar Jun 10 '21 08:06 mgubis

Same issue here. Nextcloud is basically the biggest battery drainer in the background when I lay my phone overnight during sleep.

No auto sync is turned on, I sync contacts using DavX5, but DavX5 is using less battery overnight.

I don't have any clue what Nextcloud is doing in background, nor do I have any clue why it needs to do those things.

J4gQBqqR avatar Jun 19 '21 15:06 J4gQBqqR

I too am experiencing this as of last week.

b-m-f avatar Jul 17 '21 07:07 b-m-f