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

No write access to external micro SD card #5610

Open
caco3 opened this issue Mar 9, 2020 · 38 comments
Open

No write access to external micro SD card #5610

caco3 opened this issue Mar 9, 2020 · 38 comments
Labels
approved bug hotspot: device storage Storage (on-device) related. Permissions, paths, inconsistencies, etc.

Comments

@caco3
Copy link

caco3 commented Mar 9, 2020

I have a x86 tablet where I installed Android x86. I know this is a rater unusual setup, but I don't think the issue is related to this since other apps on the same system do not have this issues to write to the external micro SD card.

Issue
The Android nextcloud client 3.10.1 has no write access to the external micro SD card. The easiest way to prove this is by trying to upload a file to nextcloud. The app then shows a warning that the file system is read only:
resized_DSC_0030

Notes:

  • The app has all permissions!
  • The app never asked me for write permissions on the external micro SD card!

P.S. The bug originally was reported in nextcloud/desktop#1840

@caco3 caco3 added the bug label Mar 9, 2020
@tobiasKaminsky tobiasKaminsky added the needs info Waiting for info from user(s). Issues with this label will auto-stale. label Mar 21, 2020
@tobiasKaminsky
Copy link
Member

* The app never asked me for write permissions on the external micro SD card!

This should be asked…at least something like "wants to access images, etc."?

@caco3
Copy link
Author

caco3 commented Mar 22, 2020

@tobiasKaminsky Please let me know how I can provide more information.

@tobiasKaminsky
Copy link
Member

tobiasKaminsky commented Mar 30, 2020

Can you go to app settings (on android side) and check Nextcloud permission if storage is allowed?

@drdanz
Copy link

drdanz commented Mar 30, 2020

I have the same issue, storage permission is allowed, but I never had to confirm the access to the SD card. This article might be related.

@tobiasKaminsky
Copy link
Member

Which Android version do you use?
And @drdanz which device?

@drdanz
Copy link

drdanz commented Apr 4, 2020

Nokia 7.1 Android 10

@tobiasKaminsky
Copy link
Member

I have the same issue, storage permission is allowed, but I never had to confirm the access to the SD card. This article might be related.

I guess that reading external storage is then just granted.

@caco3 without having access to such a device, I fear that I cannot do anything.
In your first screenshot "SD Card" should be the extern storage card?
It seems that this is a link (on unix fs), which cannot be resolved by Android?

@caco3
Copy link
Author

caco3 commented Apr 7, 2020

@tobiasKaminsky

In your first screenshot "SD Card" should be the extern storage card?
It seems that this is a link (on unix fs), which cannot be resolved by Android?

You are mislead :)
That is just an empty file indicating that this is my SD Card. I usually have such a file so I easily see from within every file browser where I am :)

@caco3
Copy link
Author

caco3 commented Apr 7, 2020

Which Android version do you use?

Android 9 (Android x86)

@caco3
Copy link
Author

caco3 commented Apr 7, 2020

Can you go to app settings (on android side) and check Nextcloud permission if storage is allowed?

All 3 permissions are enabled (checked it already many times)

@tobiasKaminsky
Copy link
Member

Do you know if other apps/user have the same problem on x86?
Can you ask the maintainer of this?

@stale
Copy link

stale bot commented May 6, 2020

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!

@stale stale bot added the stale label May 6, 2020
@caco3
Copy link
Author

caco3 commented May 19, 2020

No, I am not aware of any other users with this problem.
I will try to get more information using the log and the development version of the app.

@stale stale bot removed the stale label May 19, 2020
@stale
Copy link

stale bot commented Jun 17, 2020

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!

@stale stale bot added the stale label Jun 17, 2020
@drdanz
Copy link

drdanz commented Jun 23, 2020

Still not fixed

@stale stale bot removed the stale label Jun 23, 2020
@tobiasKaminsky
Copy link
Member

Without any test device I fear that I can never fix this.
x86 seems to be also a very experimental thing.

@drdanz
Copy link

drdanz commented Jul 2, 2020

In my case it is not x86. Also I've seen this issue with at least 3 different phones

To reproduce, just go to settings and change "Storage path" to the SD card, then go to auto upload, and you should probably not be able to configure the "Original file will be..." option

@drdanz
Copy link

drdanz commented Jul 2, 2020

I think this might be only for folders on the SD card, though.
The "Original file will be..." option for a SD folder says "kept in original folder, as it is readonly", but it is possible to configure it for a folder on the main memory

@tobiasKaminsky
Copy link
Member

Yes, as you are allowed to write into those folders that you create (via storage option), but you are not allowed to delete other files (move is technically a copy & then delete).

@stale
Copy link

stale bot commented Aug 1, 2020

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!

@stale stale bot added the stale label Aug 1, 2020
@drdanz
Copy link

drdanz commented Aug 3, 2020

Still not fixed

@stale stale bot removed the stale label Aug 3, 2020
@wis775
Copy link

wis775 commented Aug 24, 2020

Same problem on Samsung Galaxy A6 with Android 10
Nextcloud Client Version 3.13.0

When I try to upload (or auto upload) a file from my SD-CArd (/storage/0000-0000/DCIM/Camera), I can not choose any action for the source file, because the source directory appears to be read-only (Originaldatei wird ... im Original-Verzeichnis belassen, da nur lesbar)

@tobiasKaminsky
Copy link
Member

How is the sdcard mounted? I remember that some Android/Vendor offer to mount sdcards differently, e.g. as external or internal storage.

, I can not choose any action for the source file, because the source directory appears to be read-only

As we have to rely on Android's permission management, I am not sure if we can solve this…
(there are file browser that "bypass" this and ask user for temporary permission and then use storage access framework, but this is not a solution we can use, as auto-upload should happen in background without user interaction)

@drdanz
Copy link

drdanz commented Aug 25, 2020

How is the sdcard mounted? I remember that some Android/Vendor offer to mount sdcards differently, e.g. as external or internal storage.

In my case it says "portable storage", and I can actually unmount it and insert it in a different device, therefore I assume it is external.

(there are file browser that "bypass" this and ask user for temporary permission and then use storage access framework, but this is not a solution we can use, as auto-upload should happen in background without user interaction)

I don't know how this works, but a few apps asked me to "select" the folder once, to gain access, but after the first time, the permission seems to be granted, and never asked again... I think that granting access once (either when you start the app the first time, or when you setup the auto-upload) is an acceptable solution...

@wis775
Copy link

wis775 commented Aug 25, 2020

My phone reports the SD-Card under "Portable Storage" (Mobiler Speicher). The SD-Card is writable by the app, because I can use the SD-Card for App-Data.

When I try to upload any file from the SD-Card, then I can't change the Upload Option, because it appears to be read only.
But when I try to upload a file from the Nextcloud App directory on my SD-Card (/storage/0000-0000/Android/media/com.nextcloud.client/....), then I can change the upload options.

@tobiasKaminsky
Copy link
Member

I don't know how this works, but a few apps asked me to "select" the folder once, to gain access, but after the first time, the permission seems to be granted, and never asked again...

Do you know an open source app that uses this behaviour? Then we can might adopt this?

@drdanz
Copy link

drdanz commented Aug 27, 2020

One app that does that for sure is SD Maid. Unfortunately it is not open source, but you might want to have a look at the Setup page in their wiki, perhaps you might find something useful there.
I'm quite sure I had at least another app that was doing the same thing, but unfortunately I cannot recall which one. I'll let you know if it comes to my mind...

@tobiasKaminsky
Copy link
Member

Setup page does not help code wise.
Would be great to know the other app. 🤞 that you remember it :-)

@caco3
Copy link
Author

caco3 commented Aug 28, 2020

c:geo does it AFAIK as well and is opensource.
I cant test if I am right and when the dialog comes, but in its settings one can select folders to store the data.

@drdanz
Copy link

drdanz commented Sep 16, 2020

Would be great to know the other app. crossed_fingers that you remember it :-)

Found it! The app is "Simple Gallery".
I just got the permission request while trying to move a file from the internal storage to the SD card.

I hope this helps...

@tobiasKaminsky tobiasKaminsky added approved and removed needs info Waiting for info from user(s). Issues with this label will auto-stale. labels Sep 17, 2020
@drdanz
Copy link

drdanz commented Sep 18, 2020

I just found another open source app that does the same: Open Camera
If you go to the options, "More camera controls..." and enable "Use Storage Access Framework" it starts the permission dialog.
I found some relevant code that seems relevant to me in MainActivity.java

@Keilaron
Copy link

Yes. You must use the storage access framework. This is old news -- it was created in Android 4.4!

See: https://developer.android.com/guide/topics/providers/document-provider

If you use the document provider, you can request write access that way. In my experience it only expires if the file or folder is overwritten, but there may be other things that cause that to happen, so make sure you plan for that as well (i.e., the Nextcloud app will probably need to notify that it needs access again depending on the situation).

This bug relates to #5667 and #5946 .

@costalfy
Copy link

costalfy commented Jan 3, 2021

Hi, same issue on Samsung a21s with android 10 and nextcloud app v3.14.1
Hope it help

@der-commander
Copy link

Hi same issue an samsung s7edge with android 8. and on galaxy s9 with android 10, and on all my other android galaxy Tablet devices.

nextcloud app 3.14.1

does somebody work on this issue ?

@MCMic
Copy link

MCMic commented Sep 3, 2021

Same issue I think, I cannot select an SD card as the storage folder for Nextcloud. All the downloads fail.
The app created folders on the SD card (Android/com.nextcloud.client/files or something like that), but no files.

I lost my local version of the files because I asked the app to move the files from previous folder when I selected the SD card, it failed to move them but it still deleted them from source folder :-/ (they are still on the server ofc).

I did the same operation on OSMAnd and it worked fine, it moved its files to the same SD card with no problem or errors.

[EDIT] This is with /e/ latest on FP3

@geekq
Copy link

geekq commented Feb 7, 2022

I am not sure, if more +1 needed. ;-)
But I would like to confirm, that external MicroSD cards really needs additional handling in Android.

When setting automatic upload from an SD card folder, the nextcloud upload does not work reliably and it is not possible to select Original file will be... moved to app folder due to read-only.

A working freemium (closed source) FolderSync app requires a special procedure for that case: it asks you to select the SD card. Then Android OS prompts for rights, only then the synchronization works with external card.

I am using Moto G5 with Android 8.1

@joshtrichards joshtrichards added the hotspot: device storage Storage (on-device) related. Permissions, paths, inconsistencies, etc. label Oct 8, 2023
@miragearhitect
Copy link

Same issue on a Samsung Galaxy j2 2018 on android 7.1

@salfter
Copy link

salfter commented Mar 14, 2024

Same problem with a Moto Z Play running Android 11 (/e/ 1.20). A 128GB MicroSD card is configured as external storage. Other apps talk to it just fine. I'd rather not have to use the limited internal storage for TitaniumBackup, so I told it to back up to the SD card, thinking Nextcloud would sync it over, just as it does on a OnePlus 7 Pro I also own (which only has internal storage).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved bug hotspot: device storage Storage (on-device) related. Permissions, paths, inconsistencies, etc.
Projects
None yet
Development

No branches or pull requests