How to clear other apps cache programmatically in android 11?

Viewed 413

I search a lot but can't found any solution. https://developer.android.com/reference/android/os/storage/StorageManager#ACTION_CLEAR_APP_CACHE I tried with two codes but not working.

this is first one:

Intent intent = new Intent();
intent.setAction(ACTION_CLEAR_APP_CACHE);
startActivityForResult(intent,REQUEST_CLEAR_APP_CACHE);

And this is second one:

Intent storageIntent = new Intent();
storageIntent.setAction(ACTION_MANAGE_STORAGE);
startActivity(storageIntent);

this is just open only download folder to free some space.

if anyone have solution please post. Thanks in advance.

0 Answers
Related