What must I do that Android can delete my cache files on the sdcard with the GUI?
I saved some data in /sdcard/Android/data/my.package.name/cache
but Android tells me that my app has 0B cached data. That is wrong!
You should never hardwire paths -- for example, your path shown above is incorrect for most Android devices, as /sdcard
is not where external storage resides. You should be using getExternalCacheDir()
for external cache and getCacheDir()
for internal cache.
Bear in mind, as the documentation states:
There is no guarantee when these files will be deleted. Note: you should not rely on the system deleting these files for you; you should always have a reasonable maximum, such as 1 MB, for the amount of space you consume with cache files, and prune those files when exceeding that space.
(emphasis theirs)