Created
August 1, 2016 18:39
-
-
Save li-jkwok/e460a042326e8509ada9ec23ae677bdf to your computer and use it in GitHub Desktop.
Getting Total Disk Space Available for Android Device
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
/** | |
* Get the total disk space available on this Android Device | |
* | |
* @return total size (in bytes) that is the total disk space avaialble on the device. | |
*/ | |
public static long getTotalDiskSpace() { | |
StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath()); | |
long totalDiskSpace = statFs.getBlockCount() * statFs.getBlockSize(); | |
return totalDiskSpace; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code worked for me, but im still looking for an implementation that works on old versions