Hello,
I am creating an application that needs to read and write many files and directories.
The user must be able to have direct access to these directories to put files there himself.
I am testing the application on two devices, a tablet and a phone.
With this simple block, I don't have the same result.
On the tablet, the directory is created but on the phone, I have an error message.
"Cannot create directory at /Storage/emulated/0/Gestion_hand"
Both are under andoid 11 with the same permissions on multimedia files.
After targetSdkVersion=30 you can no longer create your own subdirectories in the root dir of the external storage on Android 11+ devices. (Note: this is also not possible using SAF.)
But you can do it in one of the Shared folders like
Hello,
Thank you for your answers, I suspected that the solution was on the shareable folder.
But what I don't understand is why it works on the tablet and not on the phone. Both are under android 11 and with the same permission ???
App returns the same 908 error (and folder not created)
Added Anke's MFile extension, this does create the directory
(but now I need to copy files from the ASD to /Documents/MyFolder, this doesn't work with the file component, and no copy blocks in MFile - ah, hang on, need to put some files in the ASD - edit, no does not copy )
There are these little nuggets from Anke spread all over the community, just a case of using the correct search terms. It is getting them in chronological order that matters
I really don't know how many times I've pointed out this bug (I haven't gotten any feedback from the MIT team on it yet). I will definitely not link there anymore.
WRITE_EXTERNAL_STORAGEmust be declared in the Manifest also on Android 11+. There is ONLY one way to do this, namely to set DefaultFileScope = Legacy.