List of usage examples for android.os Environment MEDIA_MOUNTED_READ_ONLY
String MEDIA_MOUNTED_READ_ONLY
To view the source code for android.os Environment MEDIA_MOUNTED_READ_ONLY.
Click Source Link
From source file:Main.java
public static boolean checkExternalDispose() { boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; final String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else {/*from www .ja va 2 s . com*/ mExternalStorageAvailable = mExternalStorageWriteable = false; } return mExternalStorageAvailable && mExternalStorageWriteable; }
From source file:Main.java
public static boolean isExternalStorageReadOnly() { String extStorageState = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) { return true; }//from w ww.j av a 2s. com return false; }
From source file:my.extensions.app.AudioFileLister.java
private boolean musicDirectoryReadable() { String state = Environment.getExternalStorageState(); return Environment.MEDIA_MOUNTED_READ_ONLY.equals(state) || Environment.MEDIA_MOUNTED.equals(state); }
From source file:Main.java
public static boolean checkExternalStorageState() { boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else {/* w ww.j a va2 s . c o m*/ // Something else is wrong. It may be one of many other states, but // all we need // to know is we can neither read nor write mExternalStorageAvailable = mExternalStorageWriteable = false; } if (!mExternalStorageWriteable || !mExternalStorageAvailable) { // we cannot download the floor plan on the sdcard return false; } return true; }
From source file:MainActivity.java
public boolean isExternalStorageReadable() { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(Environment.getExternalStorageState())) { return true; }//from w w w.java 2 s . c om return false; }
From source file:Main.java
public static boolean isSDCARDMounted() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mExternalStorageAvailable = mExternalStorageWritable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { mExternalStorageAvailable = true; mExternalStorageWritable = false; } else {//from w w w . jav a 2 s. com mExternalStorageAvailable = mExternalStorageWritable = false; } return mExternalStorageAvailable && mExternalStorageWritable; }
From source file:org.disrupted.rumble.util.FileUtil.java
private static boolean isExternalStorageReadable() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { return true; }//from w w w . ja v a 2 s . c om return false; }
From source file:com.cyberocw.habittodosecretary.file.StorageHelper.java
public static boolean checkStorage() { boolean mExternalStorageAvailable; boolean mExternalStorageWriteable; String state = Environment.getExternalStorageState(); switch (state) { case Environment.MEDIA_MOUNTED: // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; break;/*from w ww. j a v a 2 s.co m*/ case Environment.MEDIA_MOUNTED_READ_ONLY: // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = false; break; default: // Something else is wrong. It may be one of many other states, but // all we need // to know is we can neither read nor write mExternalStorageAvailable = mExternalStorageWriteable = false; break; } return mExternalStorageAvailable && mExternalStorageWriteable; }
From source file:it.feio.android.omninotes.utils.StorageManager.java
public static boolean checkStorage() { boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else {//from w w w . j a v a 2s . com // Something else is wrong. It may be one of many other states, but // all we need // to know is we can neither read nor write mExternalStorageAvailable = mExternalStorageWriteable = false; } return mExternalStorageAvailable && mExternalStorageWriteable; }
From source file:org.digitalcampus.oppia.utils.FileUtils.java
public static boolean createDirs(Context ctx) { String cardstatus = Environment.getExternalStorageState(); if (cardstatus.equals(Environment.MEDIA_REMOVED) || cardstatus.equals(Environment.MEDIA_UNMOUNTABLE) || cardstatus.equals(Environment.MEDIA_UNMOUNTED) || cardstatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY) || cardstatus.equals(Environment.MEDIA_SHARED)) { Log.d(TAG, "card status: " + cardstatus); return false; }//from ww w .j a va2 s.co m String[] dirs = { FileUtils.getCoursesPath(ctx), FileUtils.getMediaPath(ctx), FileUtils.getDownloadPath(ctx) }; for (String dirName : dirs) { File dir = new File(dirName); if (!dir.exists()) { if (!dir.mkdirs()) { Log.d(TAG, "can't mkdirs"); return false; } } else { if (!dir.isDirectory()) { Log.d(TAG, "not a directory"); return false; } } } return true; }