SAF: App Inventor implementation of Storage Access Framework

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

Here you need to build child document’s uri using BuildChildDocumentsUriUsingTree method.

1 Like

i tried to place the block as told, source uri remain same which i initially entered
still not working?


here tree uri is
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2FWhatsApp%20Documents

here target parent uri is
content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fio.makeroid.companion%2Ffiles

Do you have write access to this?
However your blocks are still wrong. I’ll post the blocks as soon as possible.

1 Like

yes read and write access are given to the whatsapp document folder

Unfortunately, it is not possible currently to copy files from /Android/media folder with SAF, but you can expect something from v1.1 .
However you can copy files manually also, by reading and writing its content.
Also you can use file manager extensions to copy files. @bodymindpower

4 Likes

Of course its possible. You can use your FileTools or the TaifunFile extension or the File component for that (and of course you need READ permission for this).

3 Likes

I have tried all three options
TaifunFile
FileTools
File Component
I am using android 11
Error are coming, please suggest me if i am doing mistake
blocks(36)



blocks(39)


Error are in sequence that is TaifunFile then fileTools then file component.
source name in all is
/storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Documents/LastFile.bjn
destination name in all is
/storage/emulated/0/Android/data/com.try23/files/LastFile.bjn
Suggestions requested please
try23(1).aia (64.1 KB)

Have a look here:

So now you just need to get byte array from the file and write it wherever you have access.

I said you can copy file from /Android/media/, but there might be some special sub-folders like yours /storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Documents/ that only certain apps (like WhatsApp) can access.

I created the subfolder /whatsapp manually, because (as I said) I never used Whatsapp (and will NEVER do).

blocks(2)
Try this, it will work for sure

1 Like

I have understood the concept
The file which i am coping from whatsapp document folder is a zip file i hope your concept to get byte array will able to read and write in the file in ASD ?
I will myself also check
BTW thank you all for your prompt replies
Thanks @Taifun
Thanks @vknow360
Thanks @bodymindpower
Thanks @Yash_Agarwal

2 Likes