About the author
There's a unit in XE5 that deals with getting all kinds of directories on Android, and it's called Androidapi.IOUtils.
Here's what you can get:
function GetFilesDir: string; function GetCacheDir: string; function GetLibraryPath: string; // File Locations in External memory. (Accessible only to the program, but easily // readable mounting the external storage as a drive in a computer. // Files written here are deleted when uninstalling the application.) function GetExternalFilesDir: string; function GetExternalCacheDir: string; function GetExternalPicturesDir: string; function GetExternalCameraDir: string; function GetExternalDownloadsDir: string; function GetExternalMoviesDir: string; function GetExternalMusicDir: string; function GetExternalAlarmsDir: string; function GetExternalRingtonesDir: string; // File Locations in External memory. (Accessible to all programs, easily // readable mounting the external storage as a drive in a computer. // Files written here are preserved when uninstalling the application.) function GetSharedFilesDir: string; function GetSharedPicturesDir: string; function GetSharedCameraDir: string; function GetSharedDownloadsDir: string; function GetSharedMoviesDir: string; function GetSharedMusicDir: string; function GetSharedAlarmsDir: string; function GetSharedRingtonesDir: string;
Need something on the external SD card? Use one of the GetSharedXXXDir functions. Otherwise, just use the GetFilesDir function.
I've seen a lot of XE5 newbies hardcoding the path to the external SD card. Be prepared for your application not to work on any device that you've not tested if you're going to hardcode the path.
Hello,
I have written an Android app, the cache memory I would like to automatically delete on close the app.
With GetCachePath I get though the Path.
var
spath: string;
begin
sPath: = TPath.Combine (TPath.GetTempPath, '');
deleteFile (spar); // DeleteFile only deletes a file