I already tried TaifulFile, yet it is not working with android 11 user.
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.
SAF and the extension works on Android 4.4 (API 19, KitKat) and above, but the
minSdkVersion is set to API 21 (Android 5.0). So it can't be used unless the
minSdkVersion is changed in the Manifest (to API 19).
I know you know, but I still want to point it out for the others.
@vknow360, great extension but I still find it difficult to understand. Could you add more information in your documentation (SAF: App Inventor implementation of Storage Access Framework), so people like me can also understand what each method does. For eaxmple what does "getTreeDocumentId" do?
A specific question for now: is there a way to check if a file exists (in /Documents/) and if it exists, then get that file and write to it else createDocument.
I read on the forum somewhere that writing to a file with SAF is not possible, I would need TaifunFile or FileTools, is that correct?
I appreciate any help.
Where did you read this? Post a link.
Btw, it's not true.
sorry Anke, you're right I should have added a link, I can't find it anymore. Btw. I managed to save text to a file now. In DocumentCreated I save the uriString in a global variable so the next time I can check if that variable is not empty and don't do createDocument again.
Because it most likely doesn't exist.
I agree with Paul, the few examples provided by the author make this extension usable only by power users
There is some difference between
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.
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()
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.
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 ...
It is possible and you can sponsor the feature.
... to open the assets folder with your SAF extension?
How should this be possible? (I don't think so.)
No, to read file from assets as byte array.
The examples are not complete Sunny - we need them to be 'A to Z', not 'G to P', because SAF is unfamiliar territory.
I can provide examples only if I know the use scenarios.
Please suggest some of them.