Here is a test app FileTestSharedStorage_Nio.apk (5.3 MB)
with which a text file and an image can be copied from the assets to the shared storage (for devices with Android ≥ 10). This works (as it should) without WRITE permission (note: this no longer exists on Android 11). However, if the text file is to be read, incorrectly READ permission is requested and required. If READ is denied, it will not work. The image (foto.jpg) can, however, be copied into the shared storage and also displayed from there (without READ permission, as it should be). Folders (which function as shared storage and images can be copied into) are:
/Download
/Documents
/DCIM
/Pictures
If you try to delete these files, however, you will get an error message (incorrectly):
“Error 908: The permission WRITE_EXTERNAL_STORAGE has been denied. Please enable ...”.
Steps to test the app (especially on Android 10 and 11):
Install and open the app.
Deny permission.
Click first button.
Check the CheckBox and click on the first button angain.
Click on the third button (Copy bg.jpg to …).
Click on the fourth button (files … exist?).
Click on the last button (remove …).
Uninstall and reinstall the app.
Grant permission.
Continue with step 3 - 6.
Try also different folders (→ TextBox).
Note:
Regardless of how DefaultFileScope was set in the Designer, only READ permission is declared in the Manifest and not WRITE permission. But on devices with Android < 10 it must be possible to request WRITE permission.
So, as I already said in the AI2 forum, READ / WRITE permissions should be declared this way in the Manifest:
Note:
I imported the same app with → AI2 and built 2 APKs:
Designer: DefaultFileScope = Shared
Designer: DefaultFileScope = Legacy
Tested on a Pixel 2XL (Android 11):
The first one doesn’t work at all, regardless of whether or not READ permission has been granted.
The second works only if READ permission has been granted.
Important note:
If the text file or image already exists and you try to copy it again, the files are not replaced, but a new file is created (e.g.: 123(1).txt). This causes the app to stop working after the app is uninstalled and reinstalled (because the text file is then not created by the app).
If I declare WRITE permission in the Manifest (without android:maxSdkVersion="28") the deletion of the files also works (click on the last button: remove …). This makes no sense, as WRITE permission on Android 11 no longer exists, cannot be requested / granted and shouldn’t have any effect.