protected static Long getUnusedInternalStorage ( ) { try { File path = Environment . getDataDirectory ( ) ; StatFs stat = new StatFs ( path . getPath ( ) ) ; long blockSize = stat . getBlockSize ( ) ; long availableBlocks = stat . getAvailableBlocks ( ) ; return availableBlocks * blockSize ; } catch ( Exception e ) { Log . e ( TAG , "Error getting unused internal storage amount." , e ) ; return null ; } }
Get the unused amount of internal storage in bytes .