Create app-specific folder on the MicroSD (external) card to let the app able to write data there

This is a cross post from thunkable forum.

Giving the rapid progress of Makeroid in just few months, perhaps you can do it.
Neither AI nor any other distros could do it before.

Here is my original post there:
Android version 4.4 and above does not allow applications you install to write to user-installed MicroSD cards. Quoted from here:

The WRITE_EXTERNAL_STORAGE permission must only grant write access to the primary external storage on a device. Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories as allowed by synthesized permissions. Restricting writes in this way ensures the system can clean up files when applications are uninstalled.

So still there is a way for the app to write on the MicroSd, but it should be on the package-specific directory. Namely it should be inside the folders:

/Android/data/appinventor.ai_abc.xyz/
/Android/obb/appinventor.ai_abc.xyz/

Normally the folder /Android/data/ is created on the MicroSD card by Android at app install time. But if for some reason the folder doesn’t exist in your device, you need to use a system file manager app to create it. App itself can write inside this folder but it doesn’t have the permission to create it.

I checked the apps created by AI and it seems it does not create app-specific directory inside the data or the obb folders in the MicroSd. Even not all playstore apps are creating such app-specific directories in the MicroSd. It seems there is some way to do this at installation time.

I ask the gurus here, how to let the app create these folders in the MicroSd at instalation? Is there any manifest editing required to do so? Any chance that the creators of AI will include this capability in future releases?

Without this app-specific folders created at installation time, the microSd is almost useless for all AI created apps for Kitkat and above!

Thanks
P. S. : this has been discussed 1 year ago in the mit inventor Google group but nobody could do it. Here…

Makeroid apps allow you to move the app to external storage, if that’s what you’re asking?

Go to the app in settings and click “Move to SD Card”.

I mean let the app able to save files to the secondary storage. For large files it is better to save to the MicroSD card rather than the internal memory.

Reading from the secondary storage can be done using Taifun’s File extension by specifying the absolute path to the secondary storage like:
file:///mnt/extSdCard/Android/data/appinventor.ai_abc.xyz/test.txt

But it fails to write to the external storage using the same path if the folder appinventor.ai_abc.xyz is not there. It will fail to create such folder inside the external storage, despite it is able to write such folders inside the internal sdcard storage. This is the app-specific folder that should be created by some way during installation of the app. It is with the same name of the package inside /Android/data/ of the secondary storage.

Tl;dr
Copying a file to:
file:///mnt/extSdCard/Android/data/appinventor.ai_abc.xyz/test.txt
will fail, if the folder “appinventor.ai_abc.xyz” is not created by a file Manager Manually before this operation. Or if not created by the app during installation

I asked about the same thing, with having your own directory for your own app and they said if you store a file in a directory that is non-existent then it will create it manually but, it doesn’t!

It seems this is not an issue anymore. Please see the latest posts in this thread.

1 Like