Search code examples
javaandroidcachingsecurityexception

Clear another applications cache


I´ve been reading around here about cleaning another applications cahce-memory, and I´ve also tried coding my own app. The result I´ve got, is that with Androids current securitylayer, it´s not possible.

But, there is currently many cache-cleaner applications out there on the Market (Google Play)?

When I started my application which I gave the android.permission.DELETE_CACHE_FILES permission, the LogCat printed

Not granting permission android.permission.DELETE_CACHE_FILES to package <MY_PACKAGE_NAME> (protectionLevel=3 flags=0x8be46)

After some research I found out that 3:rd party apps would not be granted permissions with protectionLevel=3 so, I encounter a java.lang.SecurityException whenever I try to delete another application cache (logically)

My question is therefor: "How is these applications on Google Play permitted and able to delete other applications cache?"

Sorry for my bad English, not a native speaker


Solution

  • You can only do this if the device is rooted and your application has super user rights.