SAF: App Inventor implementation of Storage Access Framework

I understand, it is a different problem. Could it be fixed by having Activity Starter open a file explorer folder?

Hi Anke, you are right, it is a different problem.

For that solution is to grant temporary uri access to the external app which seems to be possible with ActivityStarter.

What do you mean by "internal storage". An app can only access its own (private) internal storage (privateDir).

/data/user/0/<packageName>/files/

For example:
/storage/emulated/0/Documents
or any directory from:
/storage/emulated/0/....

This is a folder in the external storage (and also one of the Shared folders).
To open / access non-media files, that are not created by the app itself, from the external storage (or even from a Shared folder) you need SAF.

See here:

that's what I tried as I put here in the photo. Unless you mean something different or another way....
saf

Button2 click has nothing to do with SAF.
You only got the filePath with SAF and the FileTools extension.

But how to open the document with SAF?
As far as I understand, SAF itself does not open files.

Trying things I have discovered that with the Librera app I can open PDFs. It is the only one that has worked for me of the ones I have tried. I don't know why, but maybe it's a clue to what happens with Android 11.
I usually use Readera from my app, which is the one that works best for me, but if Librera works on my phone it's fine!

@Toni are you using that app together with the blocks you recently posted?
it might be, that the Librera app still uses SDK29?

if there is a solution to copy the pdf file from the shared storage to the ASD, then a pdf extension could be used to open and render the pdf file from there...

did anyone find a solution to copy a non media file from shared storage to the ASD?

this is what I tried:
Unbenannt
which results in error message
Unbenannt2
which means, the SAF extension is not able to copy something into the ASD without permission?

here I tried to get permission, which failed...

Taifun

Yes, /Android subfolders don't support write operations.
You might be able to copy files manually.
For example,

@Taifun
yes, with the same blocks that I put here in the screen shots

What I don't understand is that in my mobile (with android 11) I install any app to view pdfs (Readera, Adobe, Drive, Liberar, etc...) and I can open them from any visible directory in which they are stored. And with my appinventor app I can't tell any pdf viewer (only Librera) to open the path of a file I give it.

If you know the file path then it should be possible to send it to the external app.
But as you are trying to work with SAF which provides you content uri specific to your so you need to add uri read and/or write permission to the intent to open the external app.
It is not possible with ActivityStarter currently.

1 Like

Using only ActivityStarter and a direct path like file:///storage/emulated/0/Mydocs/Text.pdf does not open the file. However the pdfs app does open that file.

The truth is that I get lost in these things.

Ok, can you post an example for read/write a text file in /storage/emulated/0/Documents with SAF ?

Excuse me I'm not an super expert, I have a problem, I created an DIR Tiket an DIR download, where I will download files, but I would like to move these files in the private dir of the app (/ Storage / Emulated / 0 / Dowload / Tiket To_ / Storage / Emulated / 0 / Android / Date / Dir app / files), and honestly I didn't understand how to use SAF you can help me with a practical example, thank you very much

To download files to the ASD is not a task for the SAF extension ... just use the web component to download directly to the ASD...

Taifun