SAF: App Inventor implementation of Storage Access Framework

Now Open Source :grin:

12 Likes

@vknow360 Nice Extension please add event Zip success and failed
Thank You

2 Likes

Sorry, for what?

4 Likes

@vknow360 Given that you commented on the corresponding thread on GitHub, would you consider implementing this as part of a core component?

13 Likes

Sure :grinning:

12 Likes

Your extension just blew up, awesome work Vknow :clap:

6 Likes

Epic !!!
:slight_smile:

4 Likes

Hello,
thanks for your extension!
I am having problems opening pdf files and listening to mp3 using ActivityStarter and have been recommended to use this extension.
I have read this post, and I see that it can do what I need for my APP, and I have made several tests but the truth is that I am not very clear with the way it works (I am not an expert).
Please could you give me an example to open a pdf file in a visible folder on the phone, without asking for read_external_estorage permissions and without ActivityStarter.

Thank you very much

2 Likes

Something is wrong with OpenSingleDocument method.
I'll get back to you once that is fixed.

3 Likes

As I already told you, here:

Works also an Android 11.

4 Likes

I tried with this code without success on Android 11
blocks

2 Likes

Did you read the examples provided in the topic?

4 Likes

because a fileName like /My Folder/Appunti.txt is not an uriString
Taifun

3 Likes

can you explain better ?

2 Likes

See this post above

2 Likes

All my attempts have failed, can modify my blocks ?

2 Likes

I'm trying to copy a mp3 file from the ASD to the /Ringtones directory
here are my blocks

I get the following error message

Permission Denial: writing com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/primary%3A/document/primary%3ARingtones from pid=13158, uid=10721 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission()

what needs to be changed?
also how can we find out, if the TakePersistableUriPermission method was successful or not?
Taifun
PS: if this works I will try to copy the file from the assets to the folder /Ringtones...

3 Likes

Probably the writing method.
Initial version writes/reads content as string, which works only for text/* files.
But v1.1beta enables you to directly write content as byte array. @Anke
https://github.com/vknow360/SAF/tree/beta

Here, Label1's text was set to created document's URI i.e. content://com.android.externalstorage.documents/tree/primary%3APictures/document/primary%3APictures%2FCompanion.png.
treeUri is content://com.android.externalstorage.documents/tree/primary%3APictures and documentUri is content://com.android.externalstorage.documents/tree/primary%3AAndroid/document/primary%3AAndroid%2Fdata%2Fedu.mit.appinventor.aicompanion3%2Ffiles%2Fassets%2FCompanion.png.

CopyDocument block seems to be not working for /Android subdirs.

Using these two blocks:

image

This is still missing from the extension :sweat_smile:

5 Likes

You might want to read the above replies again. :slightly_smiling_face:

2 Likes

Thank You very much for your big help... :cry:

2 Likes