Search code examples
androidclear-cache

Dont give permission to clear cache for 3rd party android application


Please let me know, how NOT to allow any 3rd party (e.g. clean master) application to clear my application cache.


Solution

  • The OS, or third-party apps, can clear application caches, and you cannot control this. If you have files that you do not want to be cleared, do not put them in cache directories (e.g., getCacheDir()). Put them elsewhere (e.g., getFilesDir()). Note that even these locations can be cleared by the user (uninstall and reinstall, or clicking "Clear Data" on the app's page in Settings).