List of utility methods to do SDCard Check
boolean | enoughSpaceOnPhone(long updateSize) enough Space On Phone return getRealSizeOnPhone() > updateSize;
|
boolean | enoughSpaceOnSdCard(long updateSize) enough Space On Sd Card String status = Environment.getExternalStorageState(); if (!status.equals(Environment.MEDIA_MOUNTED)) return false; return (updateSize < getRealSizeOnSdcard()); |
long | getRealSizeOnPhone() get Real Size On Phone File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); long realSize = blockSize * availableBlocks; return realSize; |
long | getRealSizeOnSdcard() get Real Size On Sdcard File path = new File(Environment.getExternalStorageDirectory() .getAbsolutePath()); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); return availableBlocks * blockSize; |
boolean | hasExternalCacheDir() has External Cache Dir return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
|
boolean | hasSDCard() has SD Card String status = Environment.getExternalStorageState(); if (!status.equals(Environment.MEDIA_MOUNTED)) { return false; return true; |
boolean | hasSDCard() has SD Card return Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState());
|
boolean | sdCardIsAvailable() sd Card Is Available String status = Environment.getExternalStorageState(); if (!status.equals(Environment.MEDIA_MOUNTED)) { return false; return true; |
boolean | isExternalStorageReadable() is External Storage Readable String state = Environment.getExternalStorageState();
return Environment.MEDIA_MOUNTED.equals(state)
|| Environment.MEDIA_MOUNTED_READ_ONLY.equals(state);
|
boolean | isExternalStorageWritable() is External Storage Writable String state = Environment.getExternalStorageState();
return Environment.MEDIA_MOUNTED.equals(state);
|