Is there any way to find out if sdcard is installed or not?

Using api logic , you can determine if the SD card is readable or writable, but it does not tell you why it is not writable.

I want to know if the user even has an SD card, if it has just been installed.

Is it possible?

+3
source share
2 answers

eg:

String state = Environment.getExternalStorageState();

if (state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {

}

Check for possible constants at: http://developer.android.com/reference/android/os/Environment.html#getExternalStorageState%28%29

+7
source
public static boolean isSdPresent() {

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

}
+6
source

Source: https://habr.com/ru/post/1789576/


All Articles