PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Overview
  • The different storage types
  • Internal storage
  • External storage
  • WLanguage functions available for managing the different storage areas
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The file system on the devices running Android is divided into two main storage areas:
  • an "internal" area.
  • an "external" or "shared" area.
The different storage types

Internal storage

The internal storage area is found in the non-volatile and non-removable memory of the device (called permanent memory). This internal storage area mainly contains the system files of the OS.
The applications are installed in this storage area by default. Some applications can be installed on the external storage area with some restrictions.
The internal storage area is always available for an application even if the device is connected by USB to a computer for example.
An application can create, modify or delete files in its own directory only (found in the internal storage area). This directory is automatically created when installing the application. In most cases, it is named "/data/data/<Name of full application package>. For example: /data/data/fr.pcsoft.MyApplication. The files found in this directory cannot be accessed by the other applications.
When uninstalling the application, the files created in this directory and in its sub-directories are automatically deleted by the system.

External storage

The external storage area can be found:
  • in the permanent memory of the device,
  • and/or in the moveable memory (SD Card storage card).
Some devices divide their permanent memory into two partitions, the first one dedicated to the internal storage and the other one to the external storage. Therefore, even the devices without location for a SDCard include two distinct storage areas.
Several external storage areas can be found on the same device: for example, the first one corresponds to the "external" partition of the permanent memory while the other one corresponds to the SDCard. In this case, we talk of primary external storage area, secondary external storage area, etc. The choice for assigning the primary storage area to such or such location depends on the manufacturer.
The external storage area may not be accessible for an application at a given time. This is the case for example when the application is connected to the computer in USB mass storage mode.
An application can access in read mode AND in write mode to all the files and directories found on the external storage area(s) of the device.
Each application can have its own directory in each one of the external storage areas of the device.
  • In most cases, the name of this directory has the following format : <root external storage>/Android/data/<Name of full application package>. For example: /mnt/sdcard/Android/data/fr.pcsoft.MyApplication.
  • This directory must contain the private application files that do not have to be shared with other applications (even though any application can access them).
  • This directory can contain sub-directories with preset system names for storing different types of files (music, film, documents, download, etc.). A proper use of these preset directories allows for a better support of these files by the system.
  • The files found in the application directory are not automatically scanned by the system (even though this can be explicitly asked). For example, the photos saved in this directory will not be listed in the photo albums of the device.
  • This directory as well as the data found in it will be automatically deleted when uninstalling the application.
Note: From Android 4.4 (KitKat), on the external storage space corresponding to moveable memory (SDCard), the applications can create, modify or delete files in their own directory only. The other files of the external storage space are accessible in read-only.
If an application owns public files that must be shared with other applications, we advise you to store them outside its own directory. In this case, the files will not be deleted when uninstalling the application.
The primary storage space of the device can contain directories with preset system names for storing different types of public files (music, film, documents, download, etc.). A proper use of these preset directories allows for a better support of the files by the system. In particular, these directories are regularly scanned by the system in order to be listed and proposed when selecting medias for example.
Permissions :
  • The READ_EXTERNAL_STORAGE permission is required to access the files found in the external storage space in read mode. This permission is automatic on the devices running an Android version earlier than version 4.4.
  • The WRITE_EXTERNAL_STORAGE permission is required to access the files found in the external storage space in write mode (creation, modification, deletion). This permission implicitly grants the read rights.
From Android 4.4 (KitKat), these permissions are not longer required to access the files found in the application directory.
WLanguage functions available for managing the different storage areas
Several WLanguage functions can be used to manage and identify the different storage spaces:
Versions 21 and later
fCacheDir
New in version 21
fCacheDir
fCacheDir
Returns the path of directory that will be used to store the data in cache on the internal storage space of application.
fDataDirReturns the path of the directory that will be used to store the database files of the application in the internal storage area.
Example : /data/data/fr.pcsoft.MyApplication/database
fCurrentDirReturns the path of the directory that will be used to store the private files of the application in the internal storage area.
Example : /data/data/fr.pcsoft.MyApplication/files
fExeDirReturns the root path of the application directory in the internal storage area.
Example : /data/data/fr.pcsoft.MyApplication
Versions 21 and later
SysCacheExternalStorage
New in version 21
SysCacheExternalStorage
SysCacheExternalStorage
Returns the path of directory that will be used to store the data in cache on the external storage space of application.
SysSpaceReturns the free space or the total space of the primary external storage space.
SysStatusStorageCardReturns the availability status of the primary external storage space : available/read only/unavailable.
Versions 21 and later
SysStatusExternalStorage
New in version 21
SysStatusExternalStorage
SysStatusExternalStorage
Returns the availability status of the external storage space of the device.
Versions 21 and later
SysMemoryExternalStorage
New in version 21
SysMemoryExternalStorage
SysMemoryExternalStorage
Returns the amount of available memory on the external storage area of the device.
Versions 21 and later
SysNbExternalStorage
New in version 21
SysNbExternalStorage
SysNbExternalStorage
Returns the number of external storage spaces found on an Android device.
SysDirStorageCardReturns the path of the root directory of the primary external storage space.
Example : /mnt/sdcard
Versions 21 and later
SysDirExternalStorage
New in version 21
SysDirExternalStorage
SysDirExternalStorage
Returns the path of directory that will be used to store files in the external storage space of Android device.
Versions 21 and later
SysRemovableExternalStorage
SysRemovableExternalStorage
Used to find out whether the external storage space corresponds to the moveable memory (SD Card).
Minimum required version
  • Version 21
Comments
Click [Add] to post a comment