Created
July 4, 2021 17:15
-
-
Save behroozAlborzi/bde8f4007758295133ab35c50e592e67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Environment; | |
public class StorageHelper { | |
public static boolean isExternalStorageWritable() { | |
String state = Environment.getExternalStorageState(); | |
if (Environment.MEDIA_MOUNTED.equals(state)) { | |
return true; | |
} | |
return false; | |
} | |
/* Checks if external storage is available to at least read */ | |
public static boolean isExternalStorageReadable() { | |
String state = Environment.getExternalStorageState(); | |
if (Environment.MEDIA_MOUNTED.equals(state) || | |
Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment