Created
June 30, 2016 12:17
-
-
Save iAviatorJose/1db9fcea577f35d0f9c2cc47be75b778 to your computer and use it in GitHub Desktop.
Check Storage State
This file contains hidden or 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
public static void checkState(File file){ | |
String state = ""; | |
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
state = Environment.getExternalStorageState(file); | |
} else if((Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)) { | |
Environment.getStorageState(file); | |
} else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT){ | |
state = Environment.getExternalStorageState(); | |
} | |
Log.d(TAG,file.getAbsolutePath() + " STATE :" + state); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment