SAF: App Inventor implementation of Storage Access Framework

ah, it worked now for me with the following block (no clu which of the mime types in the block worked and I am too lazy to check one by one):
grafik

4 Likes

A lot of discussion here, which shows how useful SAF is.

SAF was introduced @ Android 4.4, API 19 (Thanks Johannes_Ai2)

However, An App using the SAF extension will not install on an Android 4.4 Device:

thank you, it works with text/comma-separated-values

Is any way to get uri of USB drive automatically after it plugged in exists?

Not the best idea, but yet it is possible in this way.

com.sunny.usb.aix (7.2 KB)

5 Likes

Wow. Usb detector.. I didn't see this extension before. Thank you very much.

1 Like

Sorry, but still not undesrtand, how uri obtained automatically in your example. As I understand, OpenDocumentTree did that, but do I need to open file manager and choose file to get GotUri event result? Or AvailableStorage directories? But, the last one shows direct links, not the uriString.

Yes it is not possible to get mounted path of USB automatically so we need user to pick the drive himself. You can try saving the uri in tinyDb but I am worried if Android will mount usb to same location next time.

Your UsbDetector - is a miracle, really.

As a result, after around 5 seconds after usb drive attached, video on my usb drive starts to play automatically. As I understand, it will not work after particular version of Android, but Android 7 allow to do that. 8 - no. My device controlled by Android 7 (single-board computer), so I solved this part of my issue, thank you very much.

Btw, it worked on Android TV too (if version below 8)

2 Likes

Hi @vknow360. Can you tell, this extension can support from which android version?

The minimum requirement android version to use this extension? Many thanks.

Hi @zmd94 ,
Extension works on Android 5 and above versions.

Alright. Thank you for the clarification.

Next question, I can't find how to use this extension to check whether the required file is exist? Can you tell me how?

Sorry to ask, but can you tell why and for what you want to use SAF?
I am sure this will help in solving your query.

I want to check whether file is exist in user Download folder. Next, I want to move it into app specifir dir.

Then you should use TaifunFile or FileTools extension.

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.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

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.

1 Like