nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.18k stars 1.75k forks source link

Auto upload not triggered #9320

Closed christianlupus closed 10 months ago

christianlupus commented 2 years ago

Steps to reproduce

  1. Set up the app to do auto uploads (e.g. use camera DCIM folder as suggested by default)
  2. (Optionally) Empty list of uploads to have a good view on the newly created (auto) uploads
  3. Take an image (which should trigger the upload)
  4. Wait a few minutes for the app to detect the newly created file

Expected behaviour

After some time (in the range of 5-10 min) the app should at least register an upload in the uploads section. Depending on the settings (only via WiFi for example), the upload will take place immediately, be queued, or be stalled.

Actual behaviour

The upload is never queued. It should have created anything in the list (be it stalled, queued, in progress, or done in the meantime). In fact, there is nothing logged at all.

I suspect that the detection of new files somehow fails.

Can you reproduce this problem on https://try.nextcloud.com?

As no upload is triggered, no network is involved. => Not tested

Environment data

Android version: 10

Device model: Dogee S96 Pro

Stock or customized system: Stock

Nextcloud app version: 3.18.0 RC6

Nextcloud server version: 22.2.3

Reverse proxy: Apache

Logs

Web server error log

Not network related

Nextcloud log (data/nextcloud.log)

Not network related

App logs

When making a photo and looking at the logs within the app, there is no line logged within a few minutes after the photo.

Unfortunately, the logs only go back until today morning, so older logs seem to have been rolled out. I cannot compare with a time where things were working.

NOTE: Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate

Additional information

This seems to be a regression, as it used to work until recently. I was on holiday and during part of it the auto uploads were still working as intended. Sometime around Nov 06th it suddenly stopped working. I am not sure about the exact point in time as my network connection was a bit hairy and I was not always able to use the NC server accordingly. So there was build a big list of outstanding uploads over these days. At some point, this list just did not get any longer.

danielroehrig commented 2 years ago

My upload queue has been empty for 3 weeks now. Neither photos nor videos are getting picked up. If I create a new custom folder, these files will be uploaded eventually, but the camera photo/video folder seems to be ignored. It used to work flawlessly until 3 weeks ago. Things I tried:

  1. Disabling energy saving mode for nextcloud
  2. Updating nextcloud app to version 3.18 RC6
  3. Renaming the target folder on the server (so that it should see all files as missing as the folder is not there)
  4. Clearing cache, restarting the phone
  5. Checking, if the upload functionality on a different account on the same server with a different phone still works. It does.

Here some (maybe) interesting logs:

2021-11-20T10:05:45.613+0100;D;UploadsStorageManager;QUERY: (status== ? OR last_result==9 OR last_result==13 OR last_result==11 OR last_result==14 ) AND last_result!= 16 ROWID: -1
2021-11-20T10:05:45.616+0100;V;UploadsStorageManager;getUploads() got 0 rows from page 0, 0 rows total so far, last ID -1
2021-11-20T10:05:45.616+0100;V;UploadsStorageManager;getUploads() returning 0 (0) rows after reading 1 pages
---
2021-11-20T10:05:45.769+0100;V;ArbitraryDataProvider;Updating arbitrary data with cloud id: global key: media_folders value: {"imageMediaFolders":[[...]"/storage/emulated/0/DCIM/Camera",[...]],"videoMediaFolders":[]}

So, for me it seems like it looks at the right place but doesn't find any new photos or videos despite there being like 40 or 50.

ksmolder commented 2 years ago

I'm facing the same issue with Nextcloud client 3.18 for Android an a OnePlus Nord. I'm not sure however if the phone's make and model is of any importance here... During the client setup, I did notice something strange. When I select the folder to watch (example /storage/emulated/0/DCIM/Camera), the folder displayed as the "source" folder reads /storage/emulated/0/DCIM. So it seems as if the parent folder of the selected folder is watched?

AlvaroBrey commented 2 years ago

@ksmolder thanks for the tip; this might be a consequence of #8940 In the meantime try setting up the folder with the workaround there

gjedeer commented 2 years ago

For me, the last uploaded file was from November 14, no photos taken later than that have been uploaded. /storage/emulated/0/DCIM/Camera is the path in settings. Pixel phone recently updated to Android 12 - but not sure if the date of Android update was November 14.

martinmoreira commented 2 years ago

Hello. Not sure if you managed to solve this, but for me denying and re-allowing the storage permissions fixed this issue.

danielroehrig commented 2 years ago

@martinmoreira Could you elaborate? How did you do this?

martinmoreira commented 2 years ago

Of course. For me it is: Android Settings / Apps & Notifications / See all Apps / Nextcloud / Permissions / Storage Then choose "Deny" And the "Allow again".

danielroehrig commented 2 years ago

I can't believe that actually worked! Thanks @martinmoreira

christianlupus commented 2 years ago

For me, this workaround did work. So far I am not affected anymore. However, I do not know what triggered the problem and thus I am not sure if it will happen again. Also I do not know how I could get notified/aware of it happens again.

rarealphacat commented 2 years ago

It does not work for me as there is no "Storage" permission to alter between deny and allow. The only permission Nextcloud requested was Calender, Camera and Contact. I'm on Android 11, OnePlus 6, OxygenOS 11.1.2.2

cfelicio commented 2 years ago

Looks like auto upload also stopped working on my android phone right after the 3.18 release (the date of the last uploaded picture coincides with the release of the version). My other android phone still running 3.15 continues to work fine. I will try to remove / reinstall / reconfigure 3.18 and see if it works again.

IPlayZed commented 2 years ago

Of course. For me it is: Android Settings / Apps & Notifications / See all Apps / Nextcloud / Permissions / Storage Then choose "Deny" And the "Allow again".

This is not possible on Android 11, OneUI 4.0, Samsung S21 Ultra.

Does anybody have any idea what is causing this?

NicolasGoeddel commented 2 years ago

This is not possible on Android 11, OneUI 4.0, Samsung S21 Ultra.

I do not own a Samsung S21 Ultra but after a quick google search you should find it in Settings -> Privacy -> Permission Manager -> Storage

IPlayZed commented 2 years ago

Ok, so appareantly I took a picture with my phone and it triggered the upload sequence for every upload folder. Maybe the problem lies in it not being triggered by anything?

IPlayZed commented 2 years ago

This is not possible on Android 11, OneUI 4.0, Samsung S21 Ultra.

I do not own a Samsung S21 Ultra but after a quick google search you should find it in Settings -> Privacy -> Permission Manager -> Storage

Nextcloud is not there... To be more precise it seems like there is no normal storage permission for it.

However it is in Settings > Apps > Special access > All files access. For interest: I also found that on this setup you have to manually go and enable sync in system settings: Settings > Accounts and backup > Manage accounts > Nextcloud Idk if this makes a difference but shouldn't this be enabled by default?

Still, there must be some deep rooted problem with the autosync engine because it is not working on mobile internet connection, is only triggered by new items, etc.

sanchosk commented 2 years ago

Is it possible this is somehow "feature" of android instead of Nextcloud problem? It looks to me as if OS decided that I haven't opened the nextcloud client for a long time, so the permission was removed, even though it's shown as allowed. Not sure if this is it or, perhaps, this is caused by OS update... My latest OS update was sometime at start of April which is also the last time my auto upload worked. Once I removed and re-applied the permission (thanks, @martinmoreira !!!) it works flawlessly again.

IPlayZed commented 2 years ago

@sanchosk in newer Android OSes there is a feature where app permissions, if not used, are disabled. That is a good feature actually, but I am not talking about that. Nextcloud should set these options ON by default during first launch or should periodically check against them. Also, there is the seperate question of when and how uploads are triggered.

maisim commented 2 years ago

Hello. Not sure if you managed to solve this, but for me denying and re-allowing the storage permissions fixed this issue.

I can confirm this. I just discover auto upload stop working since months. When I looked at android logs, nothing was happening when a new photo was taken.

As @martinmoreira suggests, disable storage permission for nextcloud app and re-allowing it immediately make uploads start immediately

b3 commented 2 years ago

On my Fairphone 2 running /e/ OS 1.0 (which is Android 10 on my phone) this workaround also worked but I had to

  1. start settings
  2. disable the storage permission
  3. leave settings
  4. wait a bit 15/20s
  5. start settings
  6. enable storage permission

This is still just a workaround not a bug fix.

I am still curious to get why this permission seems no more effective (does it come from Android or from Nextcloud).

rarealphacat commented 2 years ago

I manually upload some newly taken picture files and that might trigger the whole auto upload process. Video files works but the auto upload process takes a bit longer to begin (~10mins). Maybe because phone still processing?

stefanholzapfel commented 2 years ago

I'm always having troubles with background activities of different apps when they are not using Google Play Services. Looks like everything not going through Google is a third class citizen in Android.

www-flomei-de commented 2 years ago

Removing storage permission and then granting it again, also fixed an auto upload issue on a Huawei Mate 20 Pro with up to date system.

Also removing and regranting those permissions led to Nextcloud discovering lots of new folders for auto upload.

rcsilva83 commented 2 years ago

@www-flomei-de this also worked for me on my Xiaomi Poco F1! Thanks a lot!

benibr commented 1 year ago

Thanks for the workaround of reallowing the storage permission, I was going mad.

I can confirm, that with very large folders, the autouploading does not start instantly but after some minutes is did.

drumstick77 commented 1 year ago

This still solution still doesn't work for me guys. I'm on Samsung s22 ultra. It was working on my old server that went kaputz. So I've rebuilt it, for my laptop sync'd again successfully, but Android still says no. Any ideas? Thanks

nZeus commented 1 year ago

Still doesn't work. Could you please add some information to the page with the status? E.g. Pending permissions, Indexing, etc? This issue is so frustrating. Actually, this is the core feature, and it doesn't work.

drumstick77 commented 1 year ago

Uploading files manually works, but configuring it with auto upload doesn't even after trying the following:

thiscantbeserious commented 1 year ago

This is an issue with the App.

You can circumvent this by using FolderSync from the Play-Store which has Nextcloud-Support and syncs instantly without any issues.

The advantage to this is that you can also periodically sync folders with that one - not just when new files are detected - so that rules out any permission based issues and enforces a sync regulary.

9ycbgf0k8fpg commented 1 year ago

I had the same issue, with no new pictures detected by the Nextcloud App since a few weeks. Disabling and re-enabling storage permission did solve my issue.

theOryol commented 1 year ago

Hello. Not sure if you managed to solve this, but for me denying and re-allowing the storage permissions fixed this issue.

This also worked for me... it took so long to find a fix for this issue. Not that you really call this a fix, but hey...

haarp commented 1 year ago

Re-applying storage permissions also worked here. Additionally, afte doing so, many more objects are showing up in Settings->Auto upload. It seems whatever got broken prevented it from picking up (new) files.

rcsilva83 commented 1 year ago

When I started using Nextcloud, the last thing I'd think it was going to be problematic was the file storage and sync features. It's kinda disappointing it is bugged and for so long. Unfortunately I have a feeling about all Nextcloud's modules that bug reports don't get much attention although new versions with new features are released often.

sanchosk commented 1 year ago

I am not sure this frustration is properly targeted. It seems to me that Android OS removes the privileges silently. The new version of /e/ OS now adds option for Android to remove unused privileges from apps. Once this is unchecked, the app will keep its rights forever - just testing mine nextcloud to check if it will run into the same problem - my only worry is that I now need to NOT turn on my nextcloud app for some time ;)

rcsilva83 commented 1 year ago

I don't think this is what is happening because the workaround is revoke the permissions and then grant them again. So the permissions weren't removed by the OS.

Additionally, Android only revokes permissions from unused apps. If Nextcloud is syncing in background all the time, it being used. That's why the OS doesn't revoke permissions from Google Photos, for example.

meldarionqeusse commented 1 year ago

I have been using auto upload without any problems cor the past 2.5 urs on 4 different devices, until today when my main phone refuses to sync after I had to uninstall nextcloud and reinstall it.

When I went to the auto upload feature the app crashed and gave this error well part of it cause it is very long and would not let me paste all of it here. I figured it was permission so I went to setting gave storage permission to nextcloud and I was able yo setup auto upload but so far (3hours later) nothing has started uploading not even when I take new photos.

I am running NC 25.0.2 and Android 9. I tried NC android app from googleplay and latest version downloading it directly from github, tried removing storage permission and re-enabling them. I will let it be over night see if it fixes itself

Exception in thread "DefaultDispatcher-worker-1" java.lang.StackOverflowError: stack size 1041KB
    at com.owncloud.android.utils.PermissionUtil.requestExternalStoragePermission(PermissionUtil.kt:123)
    at com.owncloud.android.ui.activity.SyncedFoldersActivity.onRequestPermissionsResult(SyncedFoldersActivity.kt:781)
    at android.app.Activity.requestPermissions(Activity.java:4477)
    at androidx.core.app.ActivityCompat$Api23Impl.requestPermissions(ActivityCompat.java:850)
    at androidx.core.app.ActivityCompat.requestPermissions(ActivityCompat.java:520)
    at com.owncloud.android.utils.PermissionUtil.requestStoragePermission$doRequest(PermissionUtil.kt:163)
    at com.owncloud.android.utils.PermissionUtil.requestStoragePermission(PermissionUtil.kt:188)
    at com.owncloud.android.utils.PermissionUtil.requestExternalStoragePermission(PermissionUtil.kt:139)
    at com.owncloud.android.ui.activity.SyncedFoldersActivity.onRequestPermissionsResult(SyncedFoldersActivity.kt:781)
    at android.app.Activity.requestPermissions(Activity.java:4477)
    at androidx.core.app.ActivityCompat$Api23Impl.requestPermissions(ActivityCompat.java:850)
Darkmagister commented 1 year ago

i'm having the same issue here (app 3.23.1 android 10, NC 25.0.3) i have configured the camera folder (in nc app i see 2 folder one for video and the same one for photo but i need to configure 2 autoupload) then i removed the permission added again but only the folder for the video has been synced (maybe the number of photo is too high??) i tried to removed the autoupload from the video and leave only the photo, remove the permission and add it again and nothing...

danieldietsch commented 1 year ago

I have the same problem (App 3.23.1, Nextcloud 25.0.3, Android 13). Auto-upload worked fine, but suddenly stopped working one week ago and so far, none of the workarounds linked here helped restore the function. I will try and reinstall the app, but it just seems as if the background service is not even started (I had autoupload configured for camera images and videos as well as for a couple of apps -- none of them sync).

meldarionqeusse commented 1 year ago

is your camera folder on an SD card by any chance?

I had the same problem last month the last time I posted. I suspect it was an issue related to sd card permissions or something weird happening with android not granting permission for the sd card cause other folder on the internal memory were auto uploading.

I resolved it by installing an new sd card setup auto-upload with the new sd card took a photo to ensure it would upload. Then I Removed the new sd card and re-inserted the old one, setup auto-upload again and it started working. I am still uncertain why it stopped working and why it would not start.

danieldietsch commented 1 year ago

No, no SD card.

pdmtt commented 1 year ago

Happened to me too. Autoupload had been working until it wasn't. Can't say what happened. Upload was not being triggered for folders configured before the failure. Setting a new folder to be autouploaded triggered the upload just for it.

Unsetting and resetting access to files workaround has not worked.

Using Motorola Moto G100 with Nextcloud v3.24.1,

theaddies commented 1 year ago

Same for me. Worked great up until a few weeks ago. I have tried all sorts of things and nothing works. No photos are uploaded. Samsung Galaxy A53 and nextcloud android app 3.24.2

drumstick77 commented 1 year ago

Did you kick off any updates? Or got kicked off by accident?

theaddies commented 1 year ago

I switched to the beta version and it started working! Wonderful.

biva commented 1 year ago

Hello @AndyScherzinger and @tobiasKaminsky , I also have this issue, and I'd like to see how we can help, as users, to solve it? (sorry, I have no coding skills :( ) Maybe we could first merge some issues (this one and https://github.com/nextcloud/android/issues/8285 for example?) With all the people reporting issues here, would you have questions that would help you solve this issue?

For my own experience, it worked before, but then I saw that the app was uploading everything again, so I did a fresh install on the phone and the auto upload doesn't work anymore. I tried all the workarounds and solutions proposed in different bug reports (disable/enable permission - set up an other folder - try it on a folder with a low number of pictures - enabled sync in Android parameters - disable "sync existing files" - ...)

Thanks for your support!

007hacky007 commented 1 year ago

I'm new Nextcloud user and auto upload does not work for me either. I've tried latest Google Play version, 3.25.0 RC1, 3.19.1, but no dice on any of these versions. I've tried toggling permissions, but nothing gets uploaded - neither old or new photos. It does not work at all :(

EDIT: downgrade to 3.19.1 actually fixed autoupload for me

Blisk commented 1 year ago

I still have this problem with 26.0.2 and cant solve this.

Taoshan98 commented 1 year ago

I also had the same problem, I don't know how I solved it, I will list the steps I did:

at this point nothing was working yet, then I to try I downloaded the desktop client to my Mac and there I started syncing everything I had manually uploaded to the server.

then I deleted the 'Camera' folder that I had created previously and suddenly I saw an 'InstantUpload' folder appear among the folders with the 'Camera' folder inside and it started automatically uploading everything

I don't know how useful this comment can be but it is to share my experience.

JeCheeseSmith commented 1 year ago

I have been troubleshooting with this a few days now. I tried granting permissions again, re-syncing (turning cloud logo on/of), that didn't work. (And ofc restarting my phone and things)

Found:

I later thought it was a problem with the suggested folders so I set up custom folders for my files, photos, videos and other media. - That does work.

However, after a few hours now, the app would randomly terminated. (Which I think could be somehow caused by the OS? Or maybe the way the app works? (I haven't looked into the code) ) Battery optimization is turned for Nextcloud (as needed).

Edit: I also just found some replies on this post https://www.reddit.com/r/NextCloud/comments/telrfy/auto_upload_files_does_not_work_anymore/ , saying to go to Accounts and enable sync. I don't know if this does anything yet, it was turned off so I enabled it.

Question: Would it maybe be usefull to have some sort of post/FAQ page for people to be present with the given "workarounds"? (I found a lot of posts, articles & reddit pages about the AutoUpload features)

Edit: Using custom folders works smoother then the suggested maps by the app. It runs eventually (I've sometimes had some delays, everything's uploaded now. I hope new files will too)

biva commented 1 year ago

2 things I did and it works now, I don't know for how long it will work though:

  1. Go to Settings > Automatic upload > Press the 3 dots on the top right > Deactivate battery optimiser (sorry if the translation is not exact)
  2. I had an old installation of Nextcloud on Android, with the data in a different location → I removed this old folder Good luck!
maranov commented 1 year ago

Seems like an issue with the more fine-grained file permissions on latest Androids. Giving the Nextcloud app an All files access (Settings -> Apps -> Special app access) seems to fix the issue.

Android 13, Moto G73, NC 3.25.0 via GPlay.