nhoxbypass
nhoxbypass

Reputation: 10152

Does Android clean app cache on update?

In this document, Google says that:

When the user uninstalls your app, the system removes all your app's files from internal storage.

But does it clear app cache (or any other data inside internal storage) automatically when update app version (for example from v1.0 to v1.1)?

Because when I'm monitoring my company's app, the /cache folder goes down trend each time we release and users update to new app version.

I did a test on my phones and see that the app cache did decrease size. But I'm not sure all devices also be the same.

Upvotes: 11

Views: 10035

Answers (2)

Nha T. Tran
Nha T. Tran

Reputation: 361

Internal storage:

When the user uninstalls your app, the system removes all your app's files from internal storage.

External storage:

  • Public files: Files that should be freely available to other apps and to the user. When the user uninstalls your app, these files should remain available to the user.
  • Private files: Files that created using getExternalFilesDir() and rightfully belong to your app and will be deleted when the user uninstalls your app.

Yes, it clean data when user uninstalls, but NOT when user updates your app.

Note that some app does implement it's own cleaning mechanism by:

  • Catching android.intent.action.PACKAGE_REPLACED using BroadcastReceiver, then trigger clean some specific data.
  • Run a cron job to clean data after a time interval or when size of a folder reaches it's threshold/upper limit.

For detailed information, see this.

Upvotes: 7

Gül Eda Aydemir
Gül Eda Aydemir

Reputation: 49

Uninstall will only remove internal files bundled with the application, folders create in the external storage will not be deleted when uninstall. for database, the database will be deleted when uninstall but will remain for updated application.

Still on the database, its depends on the way the developer built the application, if there is a change of database version, there can be a replace or a complete removal of the database.

Also I'm adding a link that I hope will help you; https://developer.android.com/training/data-storage/files

Good Luck, G.

Upvotes: 1

Related Questions