I want to write a utility where the user can select a set of installed apps and clear their data caches i.e. like the way you can do manually using the built-in Settings->Applictions settings screen with the “Clear cache” button.
How can I access how much cached data each app has and programmatically clear these caches?
Ordinary SDK applications have no rights to access, let alone modify, the caches of other applications, any more than they have a right to hack your files.
This may be possible on rooted phones with your application running as root, in which case you will have to manually construct the paths based upon the apps’ package names.