I am having a problem. I have a galaxy tab that comes with 16gb of internal storage and 2 gb of sd-card card.
when I use environment.getExternalStorageState, it returns mounted. However, when I remove the sd-card from my galaxy tab, it still returns mounted because it considers the internal storage as the external storage. Is there any way in which I can differentiate between the actual SD-Card and the Internal Storage?
Thanks
I try like this
or this example would help you
You might be able to determine the sd card's mount path and if its not related to the system then its probably external media. Try checking out this link here:
Find an external SD card location
There doesn't seem to be any public API for this currently. You could check by looking at
/proc/mounts
but your code would then be device-dependent, since not all devices mount secondary external storage (SD card) at the same place.I've created a check of my own, and it works. It checks if secondary, real SD card is present. Tested it on Samsung Galaxy s5 neo, Alcatel one touch 5020x, and on HTC One X. The code should work on KITKAT devices since it uses the app default dir to check.
I create a String of default app path storage on primary storage. Then change "primary" to "secondary", then try to create a folder and check for existance.
Heres the code:
I think
/storage/sdcard0/
is used for internal sdcard and/storage/sdcard1/
is used for external sd card if there are two storage option present. if you are checking a file is present either in any of sdcard or not you should check all possible paths.