am making a app that clears the internet cache when you click a button. In which i want it to have the permission you clear other app data. I have tried many different codes and cant find a one that is used for this purpose. Is there a special permission i need or is it even possible.
I have tried this code in MainActivity.java but cant seem to get it to work:
private void clearPreferences() {
try {
// clearing app data
Runtime runtime = Runtime.getRuntime();
runtime.exec("pm clear com.android.browser");
} catch (Exception e) {
e.printStackTrace();
}
}
Any help would be great. Thanks!