Emulated External vs External SD


#1

In the challenge I want to ultimately be able to look at the created JSON file on the SD card from my PC. The problem I am getting is that although getExternalStorageState says external storage is indeed available (MEDIA_MOUNTED), getExternalStorageDirectory continually returns “/storage/emulated/0”, which is NOT on my SD card, but is in device storage.

  1. While I can cause the data to be saved and restored to this location, and I can grab it via USB connection how do I go about actually making it go to the external storage which seems to be at /storage/extSdCard?

  2. Also when viewing the device’s files in the DDMS File Explorer where would I find this? In /storage I see an “emulated” folder but cant seem to navigate to /stoarge/emulated/0 which the MyFiles app and the view of the Phone directory via USB from my PC seem to be able to navigate to. I suspect that this has something to do with DDMS not being cognizant of the virtual mount point etc.

Well I found the answer to #2 - /storage/emulated/0 contents are in /mnt/shell/emulated/0 …

And as for #1 apparently this is something that happens on Samsung and various OEM devices - this workaround looks awful - sigidin.blogspot.com/2011/08/che … droid.html

Is there a better way for finding the external SD that works on ALL android devices? From what I am reading it seems there is not since OEMs are all doing it differently and they set the result of getExternalStorageDirectory to be whatever suits them. Even scanning the mount table and config files and parsing them as the above attempt will not guarantee a way that works for all devices going forward. This bites in a BIG way.

I am running on a Samsung Galaxy S4.

I am interested to hear BNR’s take on this absurdity.


#2

I wish I had a different take on it than you do, but you’ve pretty much got the state of things. We’ll be updating our coverage to reflect this in a future edition.


#3

Thanks again Ward - the book is very helpful and these forums reinforce very well. BNR definitely sets a high standard!
Regards,
Mike