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
;
GetCacheDir:
GetLibraryPath:
// 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.)
GetExternalFilesDir:
GetExternalCacheDir:
GetExternalPicturesDir:
GetExternalCameraDir:
GetExternalDownloadsDir:
GetExternalMoviesDir:
GetExternalMusicDir:
GetExternalAlarmsDir:
GetExternalRingtonesDir:
// File Locations in External memory. (Accessible to all programs, easily
// Files written here are preserved when uninstalling the application.)
GetSharedFilesDir:
GetSharedPicturesDir:
GetSharedCameraDir:
GetSharedDownloadsDir:
GetSharedMoviesDir:
GetSharedMusicDir:
GetSharedAlarmsDir:
GetSharedRingtonesDir:
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