Hello Adriana
- We need to know the exact Android version of both Tablets.
- What is the actual path string assigned to 'NombreDirectorio'.
... it may need to be a full path: '/storage/emulated/0/Download/Documents/'
The one that works fine is android 6, the one with the error is android 11.
Nombre directorio is just /Download/
On Android 11+ you can only access non-media files (in one of the Shared folders, like /Download
), that are created by the app itself. Otherwise you need SAF.
Read my previous post.
thankyou very much Anke, how can I get SAF in my app inventor?
After a quick search in the community you could have found this
Taifun
Hello, does anyone knows the equivalent to the functions:"isDirectory" or "Exists"
And the equivalent to the block: "GotText"
Thankyou!
I don't really know as the SAF examples are all snippets and assume a familiarity that I for one do not have.
However, this is roughly what you are looking for. My understanding is that you need to make a SAF tree (List) of available files to get the Uri of the one you want to read.
@vknow360 it would really help everyone if you could create a fully working example, Blocks and AIA (I cannot read most of the Blocks images you have posted on the extension page, the text is too tiny on my screen) that:
- Finds a text file
- Checks the File size
- Reads the File
...without presuming that any preparation required has been performed.
Btw, this is another bug with the File
component:
It should work without
READ
permission on all Android versions.
See also here:
Anke, if there is more than one text file in the directory, you can't leave the title blank, so therefore it's necessary to list the files in the directory in order to pick the correct one (if it is there). Before you can list the files of a directory, you need to know the directory path.....
I don't quite understand where the connection to my statement is.
The simple questions are:
- Is there a specific directory and
- a specific file in that directory or whatever directory?
Whether there are other files in this or that directory is another question.
Anyway, it's a bug in any case, because it should be possible to check this without requesting
READ
permission.
.... my comments are with reference to your example in post #11
That was just an explanation that these blocks basically (always) work (regardless of SAF). However, these are not required, because you have to open (select) a directory in order to be able to use SAF.
Therefore, these blocks are not required for SAF.
Thankyou very much Anke, can I leave the file in the /Downloads/ folder?
And also can you explain a little this block of code(when saf got uri)? I tried implementing it but it doesn't seem to work, (with the 2 other blocks to read a file) , my mit app gets 'stuck' and it disconnects.
Thankyou!
Adriana, could you please re-post your Blocks using App Inventor to capture them:
Right-mouse in the Blocks work area and select "Download Blocks as image"