Search code examples
androidandroid-sdcard

Android External Storage among mobile brands


I am facing interesting problem. I have discovered, that Samsung in it's own Android phones has two implementations of storage.

1st: /sdcard - is internal memory and /sdcard/external_sd is actually inserted memory card

2nd: /storage/sdcard0 - is internal memory and /storage/ExtSdCard is actually inserted memory card.

My app needs data to be stored in sd card, so I am facing problem, how to determine, which folder might be sd card link or not. Do you know situation of any other Android maker (LG, HTC, Sony), how to cope with external SD cards and how they are visible in android system?


Solution

  • It is really so simple. When you consider your samsung mobiles it is the internal storage that acts as your sdcard.

    if you are looking for to save a file in Sdcard, you have to stop hard coding the path like,

    /mnt/sdcard.. and so. 
    

    instead use, Environment.getExternalStorageDirectory();

    This will return the path to your sdcard straight away.

    And from there, add Environment.getExternalStorageDirectory()+File.separator+"your directoryname";

    And this works for all brands not unique to Samsung.