Android清理应用程序是否在更新时缓存? [英] Does Android clean app cache on update?

查看:128
本文介绍了Android清理应用程序是否在更新时缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此文档中,Google表示:

In this document, Google says that:


当用户卸载您的应用程序时,系统将从内部存储中删除您应用程序的所有
文件。

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

但是在更新应用程序版本(例如从v1.0到v1.1)时会自动清除应用程序缓存(或内部存储中的任何其他数据)吗?

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)?

因为当我监视公司的应用程序时, / cache 文件夹会在每次发布时下降趋势,并且用户会更新到新的应用程序版本。

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.

推荐答案

内部存储

当用户卸载您的应用程序时,系统将从内部存储中删除您所有应用程序的文件。

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

外部存储空间


  • 公共文件:其他应用和用户可以免费使用的文件。当用户卸载您的应用程序时,这些文件应保持对用户可用。

  • 私人文件:使用 getExternalFilesDir()创建的文件正确地属于您的应用程序,并且在用户卸载您的应用程序时将被删除。

  • 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:


  • 捕获 android.intent.action.PACKAGE_REPLACED 使用 BroadcastReceiver ,然后触发清除某些特定数据。

  • 运行cron作业以在一定时间间隔后或文件夹大小达到阈值/上限时清除数据。

  • 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.

这篇关于Android清理应用程序是否在更新时缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆