Android应用程序静态存储

发布于 2024-09-25 14:04:08 字数 293 浏览 0 评论 0原文

我正在创建一个 Android 应用程序,其中将嵌入一些音乐(约 80 MB)。我打算把它放在 res/raw 文件夹中。

由于Android将所有内容存储在其内部存储器中,这样是否太大了?我有什么选择?我提出了以下建议:

  1. 当应用程序首次启动时,将资源从内部存储复制到 SD 卡上。然后从内部存储中删除(这可能吗?)
  2. 在应用程序首次启动时从网络下载音乐。

我真的不想选择选项 2,因为我希望应用程序完全离线,并且静态音乐不会改变(版本之间除外)。

还有其他想法吗?

I am creating an Android application which will have some embedded music inside of it ( ~ 80 MB ). I was planning on putting it in the res/raw folder.

Since android stores that all in it's internal memory, is this way too large? What are my options? I have come up with the following:

  1. Copy resources out of internal storage and onto the SD card when application first starts. Afterwards remove from internal storage (is this possible?)
  2. Download music from the web when the application first starts.

I would really prefer not to have to go with option 2 since I want the app to be entirely offline and the static music is not going to change (except between releases).

Any other ideas?

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

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

发布评论

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

评论(2

风为裳 2024-10-02 14:04:08

数字 1 不是有效选项,包含原始音乐的应用程序包 (.apk) 的重量约为 80Mb。 Android 用户不会下载 80Mb 大小的应用程序(如果有足够的可用内存来安装它)。

您应该使用选项 2。在后台下载数据并将其作为缓存存储在 SD 卡中。因此,下次您的应用程序启动时,您无需再次下载它。

BTW:使用函数 android.os.Environment.getExternalStorageDirectory() 获取 sdcard 中的目录。

最好的,

Number 1 is not a valid option, an application package (.apk) with the music in the raw will weight around 80Mb. An Android user will not download an application that is 80Mb size (if there is enough memory free to install it).

You should use option 2. Downloading the data in background and storing in the sd card as cache. So the next time your app start you don’t need to download it again.

BTW: Use the function android.os.Environment.getExternalStorageDirectory() to get a directory in the sdcard.

Best,

怕倦 2024-10-02 14:04:08

2 是唯一的选择,80Mb 对于 Android 应用程序来说是巨大的。

Number 2 is the only option, 80Mb is enormous size for android application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文