File reading problem with Android 11


with Android 11, how can I urgently solve (even with some extensions...) the file reading problem (the error is 2101 .... file not found) ?

The BTDEVICE.txt file to be read is saved by another app, in the Download folder...

help please

blocks (4)

have you taken a look at this?

1 Like

Then you need SAF.

but isn't there a file extension that solves this?

Where is the Btdevice.Txt file come from?
Possible to download it from somewhere like internet by this app, then open it in the app?

no this file is saved by another app in the Downloads folder

I'm trying with SAF
Could you give me an example of how to read the content in the text file located in /Download/BTDEVICE.txt

OpenSingleDocument > Let user choose file manually > Get Uri > Read from Uri
For example:

This doesn't work for the folder /Download (and also not for the root dir of the external storage).

1 Like

This is all you need:

1 Like

ok it works... but the Download directory window opens and I have to manually select the BTDEVICE.txt file
How can I avoid it?

That's the whole point of using Storage Access Framework. User interaction is must at least one time.

1 Like

so there is no way I can read the contents of a text file in the Downloads folder with android 11 without user iteration?

Yes you can, if you request und grant MANAGE_EXTERNAL_STORAGE permission.

Anke, thanks for your interest, could you give me a concrete example of how to set MANAGE_EXTERNAL_STORAGE with appinventor?

I remind you that I have to read, in the Download folder, a file saved by another app...

Unfortunately we are subject to these strange initiatives from Google which only create avoidable problems...

I followed this guide but the settings window opens to give permission to the app but my app doesn't appear in the list at all...??

Did you try this test app?

Anke perfect with this app it works..

can I have the appinventor blocks...?

See here: How to request and grant MANAGE_EXTERNAL_STORAGE permission

ANKE, thank you so much,

Reading the file is ok...

one last thing,Why do I get the file not found error when I start the 11.mp4 video?
Am I wrong about setting the path...?

file:///... (3 slashes)
and try also an absolute path:
or a full path:

Have you seen this note in the tutorial?

Be aware that this permission is usually not granted by Google.

If you want to publish you app in Google Play this is not the way to go...