安卓ߝ在哪里存储下载的内容,内部存储还是外部存储?

发布于 2024-12-03 23:27:09 字数 488 浏览 2 评论 0原文

有关在我的应用程序中将下载的内容存储在何处的许多独立但相关的问题。

我有一个从中央服务器下载内容的应用程序。该内容有时是优质内容,或者至少是发布者不希望其自由分发的内容。据我了解,“外部”存储很容易访问,而“内部”存储则受到保护,除非手机已 root。

如果应用程序安装在 SDCARD 上(如我的配置所示),那么“内部”存储也在物理上位于 SDCARD 上吗?因此,如果我的 SDCARD 安装的应用程序下载了 100MB 的内容到内部存储,那么它实际上最终存储在 SDCARD 上,还是最终存储在设备的物理板载存储中?

如果应用程序安装在 SDCARD 上,并且包含下载内容的“内部”存储位于 SDCARD 上,那么它是以开放格式物理存储还是加密的?我似乎记得读到存储在 SDCARD 上的应用程序是加密的。这也适用于“内部”存储吗?

(删除有关将文件存储在单个目录中的问题作为 Context.getDir() 意味着可以在内部存储中创建和维护目录系统)

是否有更好的方法?

A number of separate, but related, questions concerning where to store downloaded content within my application.

I have an application that downloads content from a central server. This content is sometimes premium content, or at least content where the publisher does not want it freely distributed. I understand that the “external” storage is readily accessible whereas the “internal” storage is protected, unless the phone is rooted.

If the application is installed on the SDCARD (as mine is configured to be) then is the “internal” storage also physically on the SDCARD? Thus if my SDCARD installed application downloads, say, 100MB of content to internal storage then is it actually ending up on the SDCARD, or is it ending up in the device’s physical on-board storage?

If the application is installed on the SDCARD, and the “internal” storage with the downloaded content is on the SDCARD then is it physically stored in an open format or is it encrypted? I seem to remember reading that an application stored on an SDCARD is encrypted. Does this also apply to the “internal” storage?

(Deleted question about storing files in a single directory as Context.getDir() implies that a directory system can be created and maintained in the internal storage)

Is there a better approach?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的背包 2024-12-10 23:27:09

在 Motorola Droid 2 上使用 Android 2.2 进行了大量实验并得出以下结论:

  • 当应用程序安装/移动到 SDCARD 时,它将作为 .asec 文件存储在 SDCARD 上的隐藏 /.android_secure 目录中。这是一个加密和压缩的文件。
  • 当应用程序在“内部存储”中创建数据文件时,它们存储在设备的内部存储器中,而不是存储在 SDCARD 上。
  • 应用程序的“设置/管理应用程序详细信息”对话框具有“数据”值 - 这是应用程序在其内部存储中使用的数据量,即在内部存储器中而不是在 SDCARD 上。
  • 外部存储最终会在/Android/data 目录下的 SDACRD 从
  • “设置/管理应用程序详细信息”对话框中清除数据确实会擦除所有内容,这意味着安装的应用程序需要有足够的知识/逻辑来处理“无数据”情况。

我的应用程序是一个下载内容应用程序。这一切对我来说意味着:

  • 将我的小应用程序存储在 SDCARD 上几乎没有什么实际价值,因为它在手机上消耗的大部分存储空间都位于设备的内部存储器中。当然,允许应用程序安装在 SDCARD 上总是好的。
  • 安装包需要能够在被用户擦除的情况下恢复用户下载的内容。
  • 在内部存储唯一安装ID的概念内存工作良好,直到用户删除应用程序的数据并因此导致计算新的安装 ID。因此,为了能够记住已将哪些内容下载到设备,需要在中央服务器上有一个用户帐户,每当应用程序从头开始启动时,用户都会创建/登录该帐户。

Did a bunch of experimentation and came to the following conclusions with Android 2.2 on a Motorola Droid 2:

  • When an application is installed/moved to the SDCARD then it is stored as an .asec file in the hidden /.android_secure directory on the SDCARD. This is an encrypted and compressed file.
  • When the application creates data files in the "internal storage" they are stored within the internal memory of the device, not on the SDCARD.
  • The Settings / Manage Applications details dialog for the application has a value for "Data" - this is the amount of data the application is using within its internal storage, that is in the internal memory not on the SDCARD
  • The external storage does end up on the SDACRD under the /Android/data directory
  • Clearing the data from the Settings / Manage Applications details dialog does indeed wipe everything, which means that the installed application needs to have enough knowledge/logic to handle the "no data" situation.

My app is a download content app. What this all means to me is that:

  • There is little real value in storing my small app on the SDCARD given that the bulk of the storage it will consume on the phone will be in the device's internal memory. Except of course that its always good to allow the application to install on the SDCARD.
  • The installation package needs to be able to recover the user's downloaded content if it is wiped by the user.
  • The concept of storing a unique installation id in the internal memory works well until a user deletes the application's data and hence causes a new installation id to be computed. Thus to be able to remember what content has been downloaded to a device requires a user account on a central server that the user creates/logs into whenever the application starts from scratch.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文