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 !):
-
Download AIA
TestFile.aia (54.9 KB) -
Open AIA with Kodular or download the APK from here:
TestFile.apk (4.2 MB) -
(Create APK) install APK and open the app
If a permission is requested, deny it. (Error: 2103 may pop up)
Do nothing else! -
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)
-
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) -
Click on the “read file …” button
Deny permission! Message: "Error: 908: The permission READ … has been denied … " -
Grant permission
now everything should work as it should do without these permissions -
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