File component and EFile extension - storage permissions - Shared folder - Android 11+

On this topic @Taifun, @TIMAI2 and I had a (internal) discussion about the File component and the EFile extension regarding storage permissions. Here is a small test app that shows the problems.

I think everyone is interested in this, so I'm opening a new topic here for it.

Install the test app and do not grant storage permission when testing on Android 11+.
(Test order: Button 1, 2, 3).

On Android 11+ you will be asked to grant storage permission after clicking Button2 and Button3. If you deny permission on Button2 you get the same result as if you had granted permission. @vknow360

When clicking on Button1 everything should work (as it should, i.e. without permissions) on Android 11+.

When clicking on Button3, the well-known "Error 908: ..." (bug) appears if permission was denied.

1 Like

Note: The text files are saved in the Shared folder /Download.

I tested and got the results you indicated (although I don't see a 2nd file for Button 2?), but

could you please show the blocks, so we can see what is going on ?

The behavior is same as what you indicated.
But, I am unable to understand what the actual issue is? :sweat_smile:

Yes, because the timestamp is set at Screen.Initialize. So restart the app.

Strange that different text is read, though viewing file from File Manager shows correct text. :astonished:

Yes, so it seems that your ext. needs a full path for the ReadFrom.fileName block.

But what is even stranger is that this way (Button2) requests the storage permission.

Yes, because the last one with the same timestamp is overwritten.

This should be a concern.
EFile asks for storage permissions if

  • path starts with /
  • path does not contain asd or private dir or cache dir path

It still doesn't know about shared dirs, sadly, :face_with_hand_over_mouth:

2 Likes

Ok, now that I've found a solution for this, it's not a problem.

2 Likes

If I understand correctly, the gripe is that the user is asked for permission to save to the /Download folder when using the File component ?

Your (Anke) chart indicates otherwise:
image

To what extent?

Or do you mean that on Android 11+ no storage permissions are needed when writing/reading a non-media file to/from a Shared folder. This statement is of course true and that's exactly what this topic is about for me.

I believe I have it figured out. Trying to save/copy a file to /Download with the File component generates a 908 error.

Yes, as I mentioned in the topic description:

thank you @Anke for your tests...

can you provide a screenshot of the Button3.Click event?
@ewpatton did you put that bug already onto the bug list?

Taifun

2 Likes

It basically works without (storage) permissions on Android 11+. But not with the File component!
I have pointed this out countless times before.
(And this affects all components that can store something.)

Thank you for your sharing!!!
I test this apk(File_EFile_test.apk) and it is perfectly running on my device(Android 12, S20+).
However, when I test Mfile and other permission extensions on my own project. Unfortunately it always shows Error 908.
Can you please provide me the aia(File_EFile_test.apk) to help me find out the problem :pray::pray::pray:
This is my bolck~
Thank you so much!