2

Apparently external storage on Android (referred to by Environment.getExternalStorageDirectory) doesn't have to be an SD card. In fact, it doesn't even have to be external!

How can I refer to this storage in the UI? For example, if it is currently not accessible, I want to surface an error to the user. If I say "external storage" or "SD card", I may confuse users of some devices. Is there a way to appropriately identify it?

Hilton Campbell
  • 6,065
  • 3
  • 47
  • 79

2 Answers2

1

A look at the docs for Environment.getExternalStorageDirectory():

Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.

Sounds like shared storage would be a good term.

Matthew
  • 44,826
  • 10
  • 98
  • 87
  • Except this may confuse users too, I would not think instantly of my SD card if I saw "shared storage" – Dre Mar 07 '11 at 03:07
  • yes, that's right. It might be good to get users acclimated to the "right" way of thinking though. – Matthew Mar 07 '11 at 03:09
  • While it may not be a technically preferred term, I often find myself saying "**user storage**." The term doesn't say anything about whether the storage medium is internal or external, removable or permanent. It also avoids questions of who or what is sharing the storage. However, I'm using the term in different contexts that are less formal and less persistent than an app's UI. It might be better to stay consistent with terms commonly used elsewhere. – erichamion Mar 07 '11 at 05:12
  • Maybe "storage" would be a good term, and not to mention the internal storage at all. Do users ever need to think about storing things in the internal storage? – Matthew Mar 07 '11 at 05:26
  • 1
    In the app I'm working on, I probably don't need to distinguish between internal and external storage, so storage will work. I'm just concerned that "storage" isn't as expressive as "SD card" in the case that it is, in fact, an "SD card" that is missing. I was hoping the API would somehow provide a localized string or a storage type enum that I could use. – Hilton Campbell Mar 08 '11 at 03:11
0

I need to solve the same problem, and I think I just found our solution!

http://developer.android.com/reference/android/os/Environment.html#isExternalStorageRemovable%28%29

The Environment class provides the following method:

public static boolean isExternalStorageRemovable()

Returns whether the primary "external" storage device is removable. If true is returned, this device is for example an SD card that the user can remove. If false is returned, the storage is built into the device and can not be physically removed.

Sounds like exactly what we need.

EDIT I just noticed it was added in API level 9, which may not have existed when you first asked this question.

Rob K
  • 294
  • 2
  • 10