Search code examples
androidsd-card

Is there a way to tell if the sdcard is mounted vs not installed at all?


Using the api logic you can detect if the sd card is available for read or write, but it doesn't tell you why it is not writable.

I want to know if the user even has a sd card vs if it just mounted.

Is this possible?


Solution

  • for example:

    String state = Environment.getExternalStorageState();
    
    if (state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
    
    }
    

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