AI2 Files block - shared scope file storage cannot read / write text files to media folders

Both storage permissions are required on all Android versions. Unfortunately incorrectly even on Android 11+ (meaning it should work on Android 11+ without any storage permissions).

In order for both permissions to be declared in the Manifest on all Android version (even on Android 11+), → DefaultFileScope must be set to → Legacy in the designer.

Note: WRITE permission is no longer avialable on Android 11, but is still wrongly needed to make it work on Android 11+ devices.

Check this app (especially on your Android 11+ devices). Download the aia, build the APK and install it:
textFile_save.aia (2.7 KB)

Screenshot - Android 11 & 12

grafik

Blocks

I've already pointed out this bug countless times, last also on Niotron.

This is definitely my last statement that I will make on this subject. Too many times I've asked the MIT team for an answer/clarification on this.

4 Likes

I have downloaded and run your aia but I get the same errors. See attached images



Did you test with Companion or the APK?

Add a 2 at the end of the path, like this:

/Documents/myTextFile2.txt

grafik

and try again.

Explanation: If this file "myTextFile.txt" has already been created by another app, it cannot be overwritten (on Android 11+). Therefore the file name has to be changed.

2 Likes

Thank you all. Taifun correctly identified that I was confused by the need for two apparently conflicting assignments of the Default File Scope and the read and write permissions and that the screen Default File Scope would have to be set to Legacy. I also didn't realise that this was the essential modification in Anke's app which resolves part of the question raised in this thread.

Hi Anke, Thank you for the App and the very clear explanation. I had acknowledged your identification of this problem earlier in this thread but didn't understand it correctly until I saw your explanation just now. I also mentioned earlier that the AI2 Shared File Scope allows an app to read, write and export files that it generates, but does not allow an external text media file to be read from the Download or Documents folders and generates the "Error 2102: The File Download/Filename.txt could not be opened". This is not corrected by setting the Screen Default File Scope to Legacy. My question is whether this is intended behaviour or a bug?

To access (read / write) non-media files, that are not created by the app itself, you must use the Storage Access Framework (SAF). See also here from my overview → Some basic on Android storage:

1 Like

Here is a simple example how it works using SAF:

2 Likes

Hi Anke, Taifun, Johannes and Nishyanth.

Many thanks, for listening and answering all my questions - very greatly appreciated.

Peter

3 Likes

That worked. However, I cannot see the file until I reboot my Android phone. Closing the application is not enough. Any ideas?

The file should be created immediately, should be visible and located in this folder:
/storage/emulated/0/Documents/

grafik

Click on the 3 dots (top right) and click Refresh:

grafik

2 Likes

I would like to take the opportunity to ask @ewpatton again about some feedback on this subject...
Taifun

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.