How do I check to see how much MB or GB is left on the android device ? I am using JAVA and android SDK 2.0.1.
Is there any system service that would expose something like this ?
Try that code
StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); long bytesAvailable = (long)stat.getBlockSize() *(long)stat.getBlockCount(); long megAvailable = bytesAvailable / 1048576; System.out.println("Megs :"+megAvailable);
UPD: getBlockCount() - return size of SD card; getAvailableBlocks() - return the number of blocks that are still accessible to normal programs (thanks Joe)