What are the differences among Internal storage, external storage, sd card and removable storage?

Android

Android Problem Overview


From the official documentation:

> Using the External Storage > > Every Android-compatible device supports a shared "external storage" > that you can use to save files. This can be a removable storage > media (such as an SD card) or an internal (non-removable) > storage ...

I'm really confused about this subject. From what I understand, using external storage doesn't necessarily mean to use a removable card, am I right? However, when talking about external storage, it's always referred as "sd card".

I'm developing an app that downloads .mp3 files from the internet. I want to save those files in the phone memory (don't want to use any removable device) but for what I have learned, those files have to be saved in external memory.However, I would like to offer the possibility of importing a file from a removable device. Where and how should I save those files?

Thanks

Android Solutions


Solution 1 - Android

Difference between Internal Storage, External Storage (aka primary external storage) and Secondary External Storage?

Internal Storage: is storage that is not accessible by the user, except via installed apps (or by rooting their device). Example: data/data/app_packageName

External Storage has two types:

Primary External Storage: In built shared storage which is "accessible by the user by plugging in a USB cable and mounting it as a drive on a host computer". Example: When we say Nexus 5 32 GB.

Secondary External Storage: Removable storage. Example: SD Card.

Solution 2 - Android

When building an app that uses the internal storage, the Android OS creates a unique folder, which will only be accessible from the app, so no other app, or even the user, can see what's in the folder.

The external storage is more like a public storage, so for now, it's the sdcard, but could become any other type of storage (remote hard drive, or anything else).

The internal storage should only be used for application data, (preferences files and settings, sound or image media for the app to work). If you intent to download many mp3s, i'd reccomend saving them to external storage, as the external storage is often bigger. Besides, storing data on the internal storage may prevent the user to install other applications.

Solution 3 - Android

The Internal and External Storage terminology according to Google/official Android docs is quite different from what we think.

According to official Android docs:-

Internal Storage: By default, files saved to the internal storage are private to your application and other applications cannot access them. When the user uninstalls your application, these files are removed/deleted. Your app user also can't access them using file manager; even after enabling "show hidden files" option in file manager. To access files in Internal Storage, you have to root your Android phone. So, this is NOT what we think as internal memory of the phone - Nexus 5's 32 GB internal memory.

External Storage:

> This can be a removable storage media (such as an SD card) or an > internal (non-removable) storage

That means, both storage types like Nexus 6P's 64 GB internal memory and removable microSD card which we insert in phone's card slot are considered as External Storage.

Removable Storage means just microSD card storage, not the internal memory.

To store your app files in SD card, you may use File[] getExternalFilesDirs (String type) method in Context class. Generally, second returned path would be the storage path for microSD card (if any).

Note: I have edited - made my answer more useful after @Tunaki's comment.

Solution 4 - Android

From the Developer docs

> All Android devices have two file storage areas: "internal" and "external" storage. These names come from the early days of Android, when most devices offered built-in non-volatile memory (internal storage), plus a removable storage medium such as a micro SD card (external storage). Some devices divide the permanent storage space into "internal" and "external" partitions, so even without a removable storage medium, there are always two storage spaces and the API behavior is the same whether the external storage is removable or not.

Solution 5 - Android

I think in the operating system, it defines external storage as anything not related to the actual OS filestructure. If you recall, when you write to 'internal storage', Android will make a folder privately for your application. So basically, if this is a hidden folder of some kind, it would mean that external storage could qualify as anything not being automatically hidden or managed directly by the OS. So this would mean that it would be up to the phone manufacturer about the definition of internal storage, as they could have 1 main piece of internal flash memory with two partitions on it. One partition meant to hold the os and the other meant to let you store everything on the phone.

Basically what I'm saying is: That's more a hardware related thing, and that the concept of 'external storage' could extend even to extra internal storage (flash memory) that the manufacturer added in. You could even consider storage options defined by the user as external storage as well.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncarlosView Question on Stackoverflow
Solution 1 - AndroidVikasdeep SinghView Answer on Stackoverflow
Solution 2 - AndroidXGouchetView Answer on Stackoverflow
Solution 3 - AndroidAnVView Answer on Stackoverflow
Solution 4 - AndroidDean WildView Answer on Stackoverflow
Solution 5 - AndroidApothem Da MunsterView Answer on Stackoverflow