SAF: App Inventor implementation of Storage Access Framework

Try setting text/csv as extra mime type.

2 Likes

text/csv was my first attempt with no results

Did you solve that? I have exactly the same issue, cannot upload CSV files. I tried like this, but all csv files in my storage show greyed out:
grafik

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)

6 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.