|
|
|
|
|
- Existence and availability
- Managing files and their location
- Required permissions
SysDirExternalStorage (Function) In french: SysRepStockageExterne Returns the path of the directory that will be used to store files in the external storage space of the Android device.
sPhoto is string = VideoStartApp(viPictureCapture)
IF sPhoto <> "" _AND_ SysStatusExternalStorage(i) = sseAvailable THEN
fCopyFile(sPhoto, SysDirExternalStorage(1, sseAppPhoto))
END
Syntax
<Result> = SysDirExternalStorage(<Index> , <Type>)
<Result>: Character string - Path of specified directory.
- Empty string ("") if an error occurred.
<Index>: 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. <Type>: Integer constant Type of directory for which the path to the external storage is searched. This parameter can be one of the following constants: | | sseAppDocument | Application documents directory.
Directory accessible in Read/Write mode. | sseAppFile | Directory of files specific to the application.
Directory accessible in Read/Write mode. | sseAppMusic | Application music files directory.
Directory accessible in Read/Write mode. | sseAppPhoto | Application pictures directory.
Directory accessible in Read/Write mode. | sseAppDownload | Application downloads directory.
Directory accessible in Read/Write mode. | sseAppVideo | Application videos directory.
Directory accessible in Read/Write mode. | ssePublic | Root directory of the external storage space.
Directory accessible in read-only mode. | ssePublicDocument | Directory of shared documents.
Directory accessible in read-only mode. | ssePublicMusic | Directory of shared music files.
Directory accessible in read-only mode. | ssePublicPhoto | Directory of shared pictures.
Directory accessible in read-only mode. | ssePublicDownload | Directory of shared downloaded files.
Directory accessible in read-only mode. | ssePublicVideo | Directory of shared videos.
Directory accessible in read-only mode. |
Remarks Existence and availability - The directory corresponding to the path returned by SysDirExternalStorage may not exist. You must check its existence with fDirExist and/or create it with fMakeDir.
- Before accessing a directory located in the external storage area of the device, it is recommended to check its availability with SysStatusExternalStorage.
Managing files and their location - 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.
- When uninstalling the application, the files that group the following characteristics will be automatically deleted by the system:
- The files found in the application directory on the external storage space
- the files corresponding to the sseAppFile, sseAppMusic, sseAppVideo, sseAppPhoto, seeAppDownload and sseAppDocument constants.
- The shared files of the external storage space correspondin to the ssePublic, ssePublicVideo, ssePublicMusic , ssePublicPhoto, ssePublicDocument and ssePublicDownload constants are regularly scanned by the system to be listed. Then, the photos for example are displayed in the albums of the device. These files will not be deleted when uninstalling the application.
- From Android 4.4 (KitKat), if the external storage space corresponds to movable memory (SDCard), the applications can create, modify or delete files in their own directory only (directories corresponding to the sseAppXXX constants). The other files found in the external storage space are accessible in read-only.
- From Android 10, applications must access files located in their own directories only. Any attempt to access files outside of these directories (in read or write mode) may fail. It is recommended not to use ssePublicxxx constants to avoid errors.
Note: Applications running Android 10 and generated with WINDEV Mobile will run as usual (if you use patch 118661 or WINDEV Mobile 25 Update 4). - When the application is used on a device that runs Android 11, new restrictions appear:
- applications can no longer read or write files to the external storage outside of:
- public directories such as "Documents", "Download", "Images", etc.: use SysDirExternalStorage with ssePublicXXX constants.
- application-specific directories: use the SysDirExternalStorage function with sseAppXXX constants.
- in public directories, an application can only access (in read or write mode) the files that it has created.
Note: if the application is uninstalled and then reinstalled, it will no longer have access to files created by the previous installation in public directories on external storage.
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 2025READ_MEDIA_VIDEO: This permission allows an application to read video files from external storage. New in version 2025READ_MEDIA_IMAGES: This permission allows an application to read image files from external storage. New in version 2025READ_MEDIA_AUDIO: This permission allows an application to read audio files from external storage.
New in version 2025Note: 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|