How do I know if the SD card is present or not through Android code/API?

A

AC Question

how to know SD card is present or not through android code/API?

I have a requirement to find whether SD card is present or not in phone in an Android application.
I have used following to check it, but it returns true, even if SD card is not present.

android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)

I did not find any proper solution which will work on different OEM's phone and tablet.

Quick help will be appreciated!
 

Forum statistics

Threads
943,143
Messages
6,917,489
Members
3,158,839
Latest member
akbarramadhani12