READ_ / WRITE_EXTERNAL_STORAGE permissions / app-Specific (Private) External Storage

Hello especially to the developers,

for several reasons I want to switch from App Inventor to Kodular. Unfortunately, Kokular also has a permission issue (READ_WRITE_EXTERNAL_STORAGE) when saving to an app-specific folder. I have already posted this issue in the App Inventor Forum, but have not received a satisfactory answer.
I would like to save files in the so-called “app-specific (private) external storage”. According to Google, this does not require READ_ / WRITE_EXTERNAL STORAGE permissions.

The path of the app-specific (private) external storage is:
/storage/emulated/0/Android/data/packageName/files

The File component requires READ_ / WRITE_EXTERNAL STORAGE. Therefore, the permission must be denied or previously removed from the Manifest. These permissions should only be needed if you want to save to a non-app-specific directory.

Steps to test the app (API ≥ 19 !):

  1. Download AIA
    TestFile.aia (54.9 KB)

  2. Open AIA with Kodular or download the APK from here:
    TestFile.apk (4.2 MB)

  3. (Create APK) install APK and open the app
    If a permission is requested, deny it. (Error: 2103 may pop up)
    Do nothing else!

  4. Check if the app-specific (private) external storage folder has been created on your device:
    Android - data - packageName - files
    (If the device has a MicroSD card, the directory should also be created on this SD card)

Note: If the folder was created, ask yourself how it was possible because you had previously denied the permission. (But actually it should be exactly like that, because you wrote in an app-specific folder.)

check if the folder “files” is empty (probably it is empty)

  1. Press the “save file …” button
    If a permission is required, deny it. (probably you don’t get a query)
    Anyway, check if the file “priv.txt” is created in the folder “files”:
    Android - data - packageName - files - priv.txt (result is probably: yes)

  2. Click on the “read file …” button
    Deny permission! Message: "Error: 908: The permission READ … has been denied … "

  3. Grant permission
    now everything should work as it should do without these permissions

  4. Uninstall the app
    check if the app-specific (private) directory has been deleted. This is an indication that this is an app-specific (private) directory.

On App Inventor and Thunkable I get similar issues. Only on AppyBuilder the app runs without permissions correctly.

Therefore, I assume that there is a bug here with Kodular. The app-specific (private) external storage may NOT be declared correctly; see Google Developer Documentation:
“Also starting in API level 19, this permission is not required to read / write files in your application-specific directories returned by Context.getExternalFilesDir (String) and Context.getExternalCacheDir ().”

Thanks and regards,
Anke

3 Likes

Why you need to write data without permission? Almost every app requires that. Also writing data without permission and information is not secure for users. With permissions, user can know what will app to do.

Also whatever you do, your app probably will need to write data. TinyDB, File component etc.

1 Like

I would like to get along without the permission READ_ / WRITE_EXTERNAL_STORAGE. For this, Google has given the opportunity to save in an app-specific directory.

There are many misconceptions about the terms Internal Storage and External Storage. Here is a very good overview on this topic:
Android Read Write External Storage File Example.

Here are the blocks of my test app:

Anke

3 Likes

thank you very much for bringing this up

now with the Google permission system obviously each app developer will try to use as less permissions as necessary

and reading from/writing to the app-specific (private) external storage folder does not need any permissions.
/storage/emulated/0/Android/data/<packageName>/files

https://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE

Unfortunately App Inventor:appinventor: as well as @Kodular :kodular: currently does not consider this exception. Therefore this should be updated accordingly not only for the file component, but also for other components which currently require READ_ / WRITE_EXTERNAL STORAGE permissions.

Taifun

7 Likes

I do not understand why this really good question is not answered.

Almost everyone hates permissions. The user as well as the developer. Permissions certainly have their meaning and privacy authorities may love these permissions. But if you can avoid them where they do not make sense and are not needed, it would be great.

3 Likes

Is there any reason why I do not get a response from Kodular for this issue?
I am sure that many are interested in a solution.

Anke

4 Likes

@KodularCreator can you check this guys?

3 Likes

5 posts were split to a new topic: I would like to have a .apk that does not need any permissions