SAF: App Inventor implementation of Storage Access Framework

Please provide aia file

Sorry, but for what?

3 Likes

Read post and see example

It is very easy to use

2 Likes

Please try:

Label1.text was initially set to content://com.android.externalstorage.documents/tree/primary%3AAndroid.

3 Likes

okay i am trying it :grinning_face_with_smiling_eyes:

1 Like

it was working fine and it working in other app-specific dir too

thank you :blush:

2 Likes

In that case correct me if i am correct
if i have selected the android folder in access, then can i access

android/media/com.whatsapp/whatsapp/media/whatsapp document

component_method
Please confirm
in this block the sourceUri is the uri of the file which is required to be copies and targetParentUri is the uri of the folder in which the data is required to be copied

Yes.
To learn how to build document URIs please check example 1.

1 Like

I am using an image picker to pick the image and save it in ASD

Problem which i am facing is which folder the user Should give access
If he select DCIM folder then he cannot handle the images which are received from whatsApp.
If user select Android folder to access whatsapp images then he cannot handle the images from DCIM
As such user cannot give access to full storage
What is way out for this problem

You can get access to multiple document trees.

1 Like

In that case user has to give access multiple times initially
Pl confirm?

You can ask user to give permission when needed.
If you can work with 1 folder then only ask for access to one folder then ask for access to other folder when needed.

1 Like

can it be combined with filetoolsTaifu?


how to make a folder/file in a directory which is not my apk. I want to create a backup folder there

Have you checked the examples to understand how the extension work?

No.


actually I’m still confused. i just tried a few blocks and want to create a folder/file on another ASD directory. but i am confused about it. is this block used? what block should be combined with?

Is it possible that access is given Android folder
but individual want to copy a file from sub to sub to sub folder of Android folder.
Like in my case i am telling user to take access for android folder and when he get the access i want to list files from the “content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2FWhatsApp%20Documents”
but is crashing

GetTreeDocumentId works only when the document you want to access is direct child to Tree URI.
For example if you have access to /Android dir tree then you will use GetTreeDocumentId to get document id of /Android/media and /Android/data dir while you must use GetDocumentId to get document id of a file stored in /Android/media and /Android/data dirs.

1 Like

Thanks buddy for reply
one more issue, i am trying to copy a file after giving the access to whatsapp documents folder
but file is not getting copied?


Source uri is
“content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2FWhatsApp%20Documents/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2FWhatsApp%20Documents%2FLastFile.bjn”

targetParentUri is
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fcom.bijen.lastfile%2Ffiles