gpt4 book ai didi

android - Google Play 扩展文件位置

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:04:03 27 4
gpt4 key购买 nike

我们有一个大约 600MB 的大型扩展文件,我们使用 Google Play 扩展 APK 机制获得该文件。我们还必须解压缩此文件以供实际使用。因此,整个应用程序和数据需要大约 1.4 GB 的存储空间。

据我所知,Google Play 坚持将 .obb 下载到“内部”SD,而且似乎没有任何方法可以改变这一点。我们有许多用户在他们的“外部”SD 卡上有很多可用空间,但内部存储卡上的空间有限。他们提示该应用程序占用了如此多的空间。我们能做些什么吗?

我们目前将 .obb 文件扩展为:

getExternalStorageDirectory()/Android/数据

我想我们可以询问用户他们想要它的位置,然后他们可以选择真正的外部 SD 卡。然而,这仍然会在内部 SD 卡上留下一个(基本上无用的).obb 文件,Google Play 表示我们无法删除它。

有人对如何正确处理此问题有任何建议吗?

最佳答案

根据 Expansion File Storage Location documentation , 扩展文件存放在

<shared-storage>/Android/obb/<package-name>/

其中 shared-storagegetExternalStorageDirectory() 返回的内容,对于拥有 SD 卡的用户,它应该在 SD 卡上。

不幸的是,如同一页所述:

To ensure proper behavior, you must not delete, move, or rename the expansion files.

我会特别注意这一段:

If you must unpack the contents of your expansion files, do not delete the .obb expansion files afterwards and do not save the unpacked data in the same directory. You should save your unpacked files in the directory specified by getExternalFilesDir(). However, if possible, it's best if you use an expansion file format that allows you to read directly from the file instead of requiring you to unpack the data. For example, we've provided a library project called the APK Expansion Zip Library that reads your data directly from the ZIP file.

关于android - Google Play 扩展文件位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15305400/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com