Android Question File properties and actual folders ?

MitchBu

Well-Known Member
Licensed User
Longtime User
I am confused by the File properties, and what they correspond to in the actual device. I looked at AutoComplete to understand better, but still I am confused.

- DirAssets : Where the files added to the project go. I see it on the device in Android\data\b4a.minimenu\files\virtual_assets

- DirDefaultExternal : returns the folder based on the package name. Think I understand. I see folders by the package names in my files viewer on the tablet within Android/Data. I verified that it points to Android\data\b4a.minimenu\files

- DirInternal : Save private data : I suppose this is where I should save my preference files and they will be safe from deletion/peeking, right ?

- DirInternalCache : sort of the equivalent of the Temp folder ?

- DirRootExternal : Root folder of the external storage media : is it the sd card, or the device root folder ?

- ExternalReadable, ExternalWritable : permissions.

I also found https://www.b4x.com/android/help/files.html where a lot is detailled.

Is it possible to access the user Documents folder to read and write ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The different folders are described here: https://www.b4x.com/android/forum/threads/text-files.6690/

I suppose this is where I should save my preference files and they will be safe from deletion/peeking, right ?
They are private to your app. They will be deleted when the app is uninstalled.

- DirInternalCache : sort of the equivalent of the Temp folder ?
Yes.

- DirRootExternal : Root folder of the external storage media : is it the sd card, or the device root folder ?
Almost all Android devices include an internal secondary storage (not SD card). On those devices File.DirRootExternal will point to the secondary storage.

Access to the sd card is quite limited starting from Android 4.4+.
See the RuntimePermissions tutorial for more information: https://www.b4x.com/android/forum/pages/results/?query=runtimepermissions

Is it possible to access the user Documents folder to read and write ?
There is no such folder in Android.

As a general rule:
- Store private files in File.DirInternal and public files in File.DirDefaultExternal or if you want to support runtime permissions then use RuntimePermissions.GetSafeDirDefaultExternal (see the tutorial).
 
Upvote 0
Top