I am trying to make an app which clears cache of multiple apps. I know the cache of the current app can be cleared and it is pretty straight forward using the code below
public void clearCache() {
Log.i(TAG, "Clearing Cache.");
File[] dir = mContext.getCacheDir().listFiles();
if(dir != null){
for (File f : dir){
f.delete();
}
}
}
but i cannot find any post which shows or even mentions the task that i want to accomplish so all i want to know is whether i can clear the cache of another app using its package name.
Thank you.