Android - 不同存储选项的生命周期

标签 android security android-sqlite lifetime android-external-storage

Android 提供以下数据存储选项:

Shared Preferences - 将私有(private)原始数据存储在键值对中。

内部存储 - 在设备内存中存储私有(private)数据。

外部存储 - 将公共(public)数据存储在共享的外部存储上。

SQLite 数据库 - 在私有(private)数据库中存储结构化数据。

Cache - 应用程序运行时缓存数据。(空间不足时可以清除)

我想知道的是这些存储的生命周期。

  1. 哪些存储在应用程序关闭时清除(显然是缓存)
  2. 哪些存储在应用程序重新安装时清除
  3. 哪些存储在应用程序更新时清除
  4. 卸载应用程序时清除哪些存储空间
  5. 哪些存储会清除应用程序清除数据
  6. 哪些存储会在移动设备恢复出厂设置时清除
  7. 哪些存储在 Rom 升级/更改时清除

这个问题的扩展是,在丢失未授权资源访问方面,使用哪种存储方式我的数据更安全>(用户,如果是 root,则为应用程序)。

最佳答案

Which storage(s) clears on application close (Obviously cache)

缓存

Which storage(s) clears on application re-install

缓存

Which storage(s) clears on application update

缓存

Which storage(s) clears on application un-install

缓存、SQLite、共享首选项

Which storage(s) clears on application clear data

缓存、SQLite、共享首选项

Which storage(s) clears on mobile factory reset

清除所有数据,但不清除外部存储数据

An extension to this question is, using which storage my data is more secure in terms of loss and in terms of access by unauthorized resources (users, applications in case of root).

最好将数据以加密的形式存储在SQLite中。如果您的设备已获得 root 权限,则意味着您甚至可以访问 SQLite。

关于Android - 不同存储选项的生命周期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22149631/

相关文章:

android - 在 Android 上,如何通过窗口上的元素(包括 ListView)显示背景图像?

android - navigator.share 在 WebView 中不起作用

android - 如何在Android中使用p12证书(客户端证书)

javascript - 如何防止你的JavaScript代码被窃取、复制、查看?

asp.net - 如何在自定义 WebAPI HttpMessageHandler 中安全地设置用户主体?

android - 将 arraylist<String> 值插入到 android 中的 sqlite

android - 标记错误地枚举为 MIFARE Classic,SAK = 32

android - SSL 握手异常 : Connection closed by peer

android - 房间获取 ConcurrentModificationException

android - SQLiteOpenHelper 提供的所有数据库是否保证在应用程序中使用相同的名称构造是相同的?