Copy a text file and an image from assets to shared storage (→ Android 10+)

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):

  1. Install and open the app.
  2. Deny permission.
  3. Click first button.
  4. Check the CheckBox and click on the first button angain.
  5. Click on the third button (Copy bg.jpg to …).
  6. Click on the fourth button (files … exist?).
  7. Click on the last button (remove …).
  8. Uninstall and reinstall the app.
  9. Grant permission.
  10. Continue with step 3 - 6.

Try also different folders (→ TextBox).

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:

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

@Krish @Souvik


I imported the same app with → AI2 and built 2 APKs:

  1. Designer: DefaultFileScope = Shared
  2. 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).


Here is an answer from Evan Patton (MIT team):

1 Like

Can you please look into it @Krish

1 Like

This seems to be issue from our side, it should be fixed soon

Can you share the AIA file too?

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.

1 Like

See also here:

1 Like

Is it happening On Android 11?

Yes, all of my tests …

See also here:

1 Like

Ok, I’ll send you two versions for ease of understanding:

  • FileTestShared_Nio.aia
  • FileTestLegacy_Nio.aia

So as not to cause confusion (for others), I’ll send it to you via PM.

Btw, I used my extension to get the SdkVersion instead of Device_Info.SdkVersion:

because I wanted to import the projects into AI2 as well.


After the app is uninstalled and reinstalled its not possible to read existing files on android 11 and higher versions

See here

and use SAF for this


1 Like