Android Utility ((install)) -

private fun getStorageInfo(): String { val stat = StatFs(Environment.getDataDirectory().path) val blockSize = stat.blockSizeLong val totalBlocks = stat.blockCountLong val availableBlocks = stat.availableBlocksLong val total = totalBlocks * blockSize val available = availableBlocks * blockSize val used = total - available

private fun formatSize(size: Long): String { val units = arrayOf("B", "KB", "MB", "GB") var s = size.toDouble() var unitIndex = 0 while (s > 1024 && unitIndex < units.size - 1) { s /= 1024 unitIndex++ } return String.format("%.2f %s", s, units[unitIndex]) } android utility

}

They're also great portfolio projects because they show you understand Android permissions, background tasks, and system interactions. private fun getStorageInfo(): String { val stat =