ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / System functions
  • Managing the external cache directory of application
  • Tips for using the external cache directory of application
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the path of directory that will be used to store the data in cache on the external storage space of application.
Example
// Save a file in cache on the external storage space
IF SysStatusExternalStorage(1) = sseAvailable THEN
	sCacheDir is string = SysCacheExternalStorage(1)
	IF sCacheDir <> "" THEN
		fSaveText(sCacheDir + "file.txt", MyString)
	END
END
Syntax
<Result> = SysCacheExternalStorage(<Subscript>)
<Result>: Character string
  • Path of cache directory,
  • Empty string ("") if an error occurred.
<Subscript>: Integer
Index of the external storage space to be used (if the device includes several external storage spaces).
Note: SysNbExternalStorage returns the number of external storage devices.
Remarks

Managing the external cache directory of application

The data found in this directory will be automatically deleted by the system:
  • if the system requires additional disk space (from Android 4.2 and only if the directory is found on non-movable memory such as a partition of the internal memory).
  • if the user want to delete the data in cache.
  • if the application is uninstalled.

Tips for using the external cache directory of application

  • Before accessing a directory located in the external storage area of the device, it is recommended to check its availability with SysStatusStorageCard.
  • The application files that must not be shared with other applications must be stored in the application directory on the internal storage space of the application. The path of the different subdirectories is returned by fCurrentDir, fExeDir, fDataDir and fCacheDir.
  • fCacheDir is used to find out the path of the cache directory on the internal memory of the device.
  • We advise you to limit the volume of data stored in cache and to delete this data as soon as it is no longer used.

Required permissions

Using this function automatically changes the permissions required by the application.
Required permissions:
  • READ_EXTERNAL_STORAGE: This permission allows an application to read from external storage (memory card, etc.).
  • WRITE_EXTERNAL_STORAGE: This permission allows an application to write to external storage (memory card, etc.).
  • New in version 2025
    READ_MEDIA_VIDEO: This permission allows an application to read video files from external storage.
  • New in version 2025
    READ_MEDIA_IMAGES: This permission allows an application to read image files from external storage.
  • New in version 2025
    READ_MEDIA_AUDIO: This permission allows an application to read audio files from external storage.
New in version 2025
Note: From Android 13, when publishing to Google Play Store, READ_MEDIA_VIDEO, READ_MEDIA_IMAGES and READ_MEDIA_AUDIO permissions require a justification in the Google Play console. If necessary, you can remove permissions from the generation wizard. For more details, see Storing files in Android.
Note: This feature is only available from version 2025 Update 1.
Component: wd300android.jar
Minimum version required
  • Version 21
Comments
Click [Add] to post a comment

Last update: 01/30/2025

Send a report | Local help