SAF: App Inventor implementation of Storage Access Framework

Because it most likely doesn't exist. :wink:

1 Like

I agree with Paul, the few examples provided by the author make this extension usable only by power users

There is some difference between documentation and usages.
I'll never know for what purpose an user uses the extension so there are unlimited use cases and hence can't be covered in a single post or topic. And when the extension is related to something which even Google hasn't tried to explain properly then how we are supposed to do so.
So, what we can do is to start with basics (which have been explained in first post) and if get stuck somewhere then post your query including what you are trying to do.

3 Likes

It would help you also I think, I see so many threads with kindoff same questions and answers by power users. Wouldn't it be great if there was a page with all the information with which also non power users could find information to be able to use the extension and didn't have to ask so much on the forum.

For me it would help when things like 'documentId', 'uriString' ,'dirUri', 'dirDocumentId' etc. were explained, and method names that say more about what the method does.

Other examples that would be great if they were documented:
TakePersistableUriPermission: didn't know what that would do and didn't know I had to use that until you told me.
ListFiles: also took me several days/weeks to understand that. It also makes it difficult because the params doesn't match the names of what is required as param.
dirUri -> uriString
dirDocumentId -> getTreeDocumentId()

1 Like

As Sunny (the extension developer) has already explained, the possibilities of using this extension are almost unlimited, so it is hardly possible to present all possible scenarios in tutorials/examples.

Therefore, proceed as most users usually do

  • describe your specific goal / problem(s) in detail,
  • show us what you have tried so far (blocks & aia) and
  • where you get stuck.

Then someone (at least from the power users) will surely be able to help you.

See also here:

Note: It would also be helpful (at least that's how I see it) if you open a new topic for it, so that later users can more easily find the solution to your specific problem.

1 Like

dear vknow360, I have read the usage example in the first post. But still dont get it. I can open window to pick a folder, but do not know how to open assets packaged file.

My case is simple, I want to open assets packaged file, then read it with ReadAsByte array and store it at Empty list

You cannot open the assets folder from your device. It is in the internal storage (that is only accessible with a rooted device).

Copy the relevants files from the assets to one of the Shared folders (like /Documents, or a subfolder of it) and open / pick this folder ...

1 Like

It is possible and you can sponsor the feature. :smiley:

1 Like

... to open the assets folder with your SAF extension?
How should this be possible? (I don't think so.)

1 Like


Still can't read file as list/array.
very appreciate for your help :pray:

No, to read file from assets as byte array.

2 Likes

The examples are not complete Sunny - we need them to be 'A to Z', not 'G to P', because SAF is unfamiliar territory. :koala:

1 Like

I can provide examples only if I know the use scenarios.
Please suggest some of them.

1 Like

Don't get me wrong, your work on this extension is a masterpiece, small wonder that Evan wants you to integrate it into App Inventor.

I can suggest the examples you have already made. The issues:

  1. Incomplete. SAF is baffling when you first see it, so examples should actually work stand-alone.
  2. Old version Blocks used.
  3. No introduction to the example describing what it's goal is.
  4. Unattached Blocks
  5. Anonymous inputs
  6. Unreadable images

If you make more comprehensive examples, there wouldn't be so many posts from people asking what they have done wrong - including posts from fellow Power Users.

1 Like

Create a text file in an external folder of your choice from the Root Directory and write to it.

SAF_CreateTextFile.aia (31.8 KB)
Note: Add the SAF extension first! Can be tested on your device via Companion or as an APK.

2 Likes

I tested your aia with companion, it runs well, I created file, how can I read it without selecting folder?

As far as I know, you have to access the files by selecting the folder, this is how Google have designed the system to try to block hacking.

This is all you need to create a new text file in e.g. the folder /Documents:

1 Like

Actually if I leave the directory path blank, it defaults to the Downloads folder on my phone and I can't navigate from there, so starting specifically at the Root Folder (or any specific folder) is more reliable.