is there anyone who can post the blocks to save a txt file to local storage having Android 12 and using SAF extension.?
I am doing some work with SAF (no other permissions or methods!)
I have created a sub-directory in Download, called Base, which is accessible to SAF, and want to move files (which I believe have to be done one by one, using OpenSingleDocument as a starting point to get the file's uriString) from the Download directory to the sub-directory.
The SAF extension offers this Move block:
but I am unsure of the syntax/additional blocks required for the three uri sockets.
Can any one provide an example ?
Do I need more than this:
I also tried this, but no success
Whether this will actually work or not is another matter. I am able to copy a file from Download to ASD, then copy it back to the sub-directory then delete the original file and the file in the ASD, but it is a long way around. The "unavailability" of Download as a directory to SAF is a silly thing, given you can access all the files...hopefully it is possible to move as well as copy.
Hmm, you're trying to copy/move a media file ("greenSquare.png") from /Download to a subfolder of /Download/... This shouldn't be a problem on any Android version, even without SAF, since you can access media files from anywhere with the appropriate READ
permission(s).
So the problem should only occur with non-media files (on Android 11+).
As I said.
Also, that was just an example file, I want to be able to move any file type, not just media files, and files not owned or created by the app.
Some progress, I tried this:
Which generated this response:
Therefore quite likely this this is not possible with the Download directory using SAF. I will attempt to streamline the copy, copy, delete, delete method that works.
Yes, copying does not seem to be an issue. Filetools is not required for that. I have the file component on board. But thanks, i have not tried that way yet.
Yes, it's only for showing the source file path.
After that you can remove the file from /Download, so it's the same like moving it then.
Yes, that is much better, copying directly to the sub-directory, then deleting the file in Download.
The aim is to then have a directory that replicates Download, in order to be able to use SAF to provide a list of files in that directory, just as one can with all the other shared directories. Just a pain to have to do the copying one by one.
And unfortunately, it does not seem possible to create a sub-directory in Download using SAF, unless you manually do it when opening the document tree to Download.
What's the problem with doing it using the File
component or FileTools
?
No problem, exploring SAF possibilities
...are only relevant on Android 11+. Whenever possible, avoid this.
As I said before, there are no problems copying/moving media files to a subfolder of /Download (or wherever). The problem only arises with non-media files (not created by the app), and those would have to be individually selected and copied/moved to the subfolder. There is no other wayโwithout MANAGE_EXTERNAL_STORAGE
.
Unless, as we have both demonstrated, you use SAF...
Isn't that exactly what I'm talking about?
You seem to talk about everything except SAF. As I indicated at the start, my aim is to see what I can do with just SAF, instead of having to mess about with permissions. Also, given the enforcement of the Photo and Video Permissions Policy, the application of the "MEDIA" permissions in an app will now require a declaration of intent for the Play Store.
No, what else should I talk about here if not SAF??
SAF working fine with Android 6 device here, just wanted to qualify that. I understand what you are saying regarding relevance.