Storage Permissions - READ / WRITE - DefaultFileScope → Appzard Staff

Storage Permissions (READ / WRITE) and DefaultFileScope

The DefaultFileScope (AI2, Appzard, Niotron, Kodular: DefaultFile) property in the Designer doesn’t convince me at all. I consider this to be dispensable / superfluous (not to say: confusing).

If DefaultFile is set to Legacy READ & WRITE permissions are declared in the Manifest. WRITE permission even (incorrectly) on Android 11+. Note: WRITE permission does no longer exist on Android 11+.

Why shouldn’t the storage permissions be declared like this on all Android versions:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />

or this (since AI2, Appzard, Niotron, … decided to declare requestLegacyExternalStorage=true in the Manifest, so it continues to work on Android 10):

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />

I have already asked this question on the AI2 forum countless times and have not yet received an answer. :upside_down_face:

Explanation
Since storage permissions are requested since API 23 (Android 6) at runtime, it should not be a problem / disadvantage at all to always declare them in the Manifest.

Only on Android < 6, storage permissions (READ / WRITE) are requested and granted at install-time to be able to install an app.

You can remove them from the Manifest if the app doesn’t need them and if you don’t want users to have to grant them. However, this was also the case before.

:exclamation: So I would like to hear a single argument against my proposal. → @MohamedTamer
(As I said, I haven’t received any response at all from the MIT AI2 team so far!)

The huge advantage, however, would be that it would simplify a lot and prevent countless permission bugs and issues. I have pointed this out in countless topics and posts in the AI2 forum (and in other AI2 clone’s forums as well).

See also here:

4 Likes

See also here:

3 Likes

This is really advanced stuff and is aimed more at experienced users and the Appzard team.

But every app developer should be aware of these issues as long as this hasn’t been changed.

And this applies to all (relevant) AI2 distros.

2 Likes

See also here:

3 Likes

Thanks @BodyMindPower ! I have gone through all the topics you mentioned and I agree the current file system isn’t convincing at all. I will be working on this on the next days :+1:

I agree. This seems to be a very robust solution and we could implement it in appzard. I will do some tests with the File component and hopefully it would be implemented.

2 Likes

The solution to all of these problems / bugs is actually pretty simple:

  1. READ & WRITE are declared in the Manifest on all Android versions. WRITE of course only up to API 29 (Android 10):
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />

  2. The File component can continue to store files in different locations via FileScope (App, Shared, Legacy, Private, …). So this does not have to be changed.
    (*) However, on Android 11+, WRITE / READ permissions must not be requested when files are created by the app itself and stored or accessed in one of the Shared folders.

  3. If other components (such as Canvas) should also be able to save files outside of the ASD, these components would have to have their own FileScopes. (However, this is not necessary, as you can later easily move these files from the ASD to the desired locations (Shared folders) using the File component.)

(*) On point 2:
In my opinion, the File component should not request any storage permissions. This should be done manually by the app developer if necessary.
This should make it much easier for the Appzard team to make the necessary adjustments.

Note: No app deveoper (and no extension developer) can avoid dealing with the new file system after the introduction of “Scoped Storage” by Google.
(So each app developer should decide for themselves when to request storage permissions.)

Years ago, Taifun decided to leave the requesting of storage permissions to the app developer (with his TaifunFile extension). And this was a good decision!

(I made a guide on how to access media and non-media files, especially on Android 11+, which I’ll also publish here in this forum - later.)

Final remark:
All of this is of course very unpleasant and a consequence of the constantly increasing restrictions that Google imposes on us every year. None of this has anything to do with freedom. BUT THIS WILL CHANGE … soon! I know it!

3 Likes

Please move this post to another / new topic.
It is not related to this topic.

2 Likes