Android-在SD卡上安装了应用程序后,内部存储与外部存储 [英] Android - Internal Storage vs External Storage when App installed on SD Card

查看:101
本文介绍了Android-在SD卡上安装了应用程序后,内部存储与外部存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以下载大量内容的应用程序(用户之间可能有所不同,但可能为200mb至1GB或更多).

当前,我将所有这些内容保存在外部存储中,因为这可能是空间最大的区域,例如SD卡.在大多数情况下,这都可以正常工作,但是在某些情况下,这不一定是理想的.

如果该设备像大多数平板电脑一样具有内置的外部存储,但还具有SD卡插槽,则外部存储问题会变得有些复杂.该应用程序可以安装到SD卡上,但是内容将保存在内置存储器中,而不是外部SD卡中.

如果该应用程序安装在SD卡上,是否会调用 getFilesDir()给出SD卡或内部存储器上的路径?

处理此问题的最佳方法是什么?我应该将内容保存到内部存储(在SD卡上),外部存储还是在启动应用程序时询问用户最佳想法?

解决方案

可以将应用程序安装到SD卡上,但是内容将保存在内置存储器中,而不是外部SD卡中.

不.如果设备具有外部存储,则该应用将安装到外部存储.设备是否具有SD卡都没有关系.

如果该应用程序安装在SD卡上,则调用getFilesDir()会在SD卡或内部存储器上提供路径吗?

getFilesDir()总是内部内部存储.

I have an app which downloads large amounts of content (it varies between users but could be 200mb to 1GB or more).

Currently I save all of this content on External Storage as this is likely to be the area with the most space, such as an SD card. This works fine for the most part however there is a situation where this isn't necessarily ideal.

If the device has in built external storage, like most tablets, but also has an SD card slot, the external storage issue gets a little complicated. The app can be installed onto the SD card, but the content will be saved on the built in storage, not the external SD card.

If the app is install on an SD card, will calling getFilesDir() give a path on the SD card, or the internal storage?

And what is the best way of handling this? Should I save content to the internal storage (on an sd card), the external storage or is asking the user when starting the app the best idea?

解决方案

The app can be installed onto the SD card, but the content will be saved on the built in storage, not the external SD card.

No. If the device has external storage, the app will be installed to external storage. It does not matter whether the device also has an SD card.

If the app is install on an SD card, will calling getFilesDir() give a path on the SD card, or the internal storage?

getFilesDir() is always internal storage, regardless of where the app is installed.

这篇关于Android-在SD卡上安装了应用程序后,内部存储与外部存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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