SAF: App Inventor implementation of Storage Access Framework

Have you managed to upload files from phone using SAF extension? What is that .aix file?

Can the Author, update the extension with new words on the block so ordinary lay man can guess the flow of the blocks on SAF projects? It doesn't matter even if there are large text on the blocks.

Read this thread carefully and you will understand...

1 Like

I know that. But, some one who understand this extension can definitely simplify it like any other extension.

I am planning to dedicate some time to understand this extension but later, not now.

1 Like

So tell us what your problem exactly is.
And also read this:

1 Like

Hi,

I have been all day long trying to understand this and finally got it working but I'd like to know if I can avoid the need to select the file URI by selecting the folder/file when the read/write operation will be done (OpenSingleDocument).

At some point it was mentioned that this can't be avoided but I would like to double check this in case I missed something (believe me, processing the whole post with 3 years of activity in just one day is a lot when you are not a developer).

I need to read/write a backup file, I know the name and the location beforehand and it will never change (Download/Backup.csv).

I know some of you will mention SAF is not needed but it is since when I upgrade the App it no longers opens the file and also the customer can get this backup file from the cloud and not using my App, so I do need SAF.

Can this need to select the file to get its URI be avoided?.

Thanks!.

Unfortunately, the answer is no. The user will have to select the file.

It may be possible to only have to do this once, after which you can store the uri string to tinydb for reuse, but this relies on the uri not changing when any changes are made to the file either by your app or other means. If the read fails, then fall back to file selection, and start again.

Thanks! I will implement that workaround.

is there anyone who can post the blocks to save a txt file to local storage having Android 12 and using SAF extension.?:pray:

:question:

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:

image

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:

image

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.

Hmm, I don't see any problem with that at all.

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.