1

My app is used in my job to make sales.

This app can remotely update itself (not using Google play), update its data, send information, etc...

In some point, the app reads a heavy catalog of images (several hundreds of MB). To avoid download this data, a micro SD card with all the images has been included in each device.

To read the images in the SD Card I use "Environment.getExternalStorageDirectory()". Until today everything worked ok.

However, the new devices are GalaxyTab 7 Plus, they are very cool machines, but when I use "Environment.getExternalStorageDirectory()" I got the internal SD path. The tablet recognized the External SD card (as "extSdCard") but I don't know how to access it.

I tried with the "vold.fstab" file (following the answer to this question How could i get the correct external storage on Samsung and all other devices?) but I don't trust too much... I mean... is this thing valid? I checked the vold.fstab from a GalaxyTab 10 with android 3.0 and a GalaxyTab 7 Plus with android 4.0 and they are pretty different...

So, in short: I always want get the external SD card path and if this does not exist, then get the internal SD card path (if exists). I can't do this because java don't let me choose between then when I use "Environment.getExternalStorageDirectory()"

Thanks!

Community
  • 1
  • 1
Desenfoque
  • 804
  • 2
  • 11
  • 30

1 Answers1

1

The Android SDK, at least through 4.1, does not support the notion of multiple points of external storage. Hence, there is no documented and supported means for you to get to this secondary card from a directory standpoint.

The contents of that card may be indexed by the MediaStore, through proprietary extensions added by the device manufacturer. Every device that has an external SD card that I have tried appears to do this. Hence, if there is a way you can somehow adjust your logic to not worry about where the files are, but instead to find them via MediaStore, that should work across devices.

Beyond that, you're stuck with guessing games, per some of the answers on the question that you linked to.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I don't like the idea of guessing things, so i think that I will be using your "MediaStore" idea. At first look it seems that it works in every device. – Desenfoque Aug 22 '12 at 18:54