Android Utility ⟶ | FREE |
<uses-permission android:name="android.permission.CLEAR_APP_CACHE" /> <uses-permission android:name="android.permission.BATTERY_STATS" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> : Starting with Android 11, CLEAR_APP_CACHE is restricted for third‑party apps. You'll need to use the Storage Access Framework or guide users to system settings. For this demo, we'll handle it gracefully. Step 3: Build the Main UI Create a simple activity_main.xml with three buttons and a TextView for results:
<Button android:id="@+id/btnBatteryStatus" android:text="Check Battery" ... />
return "📁 Storage:\nTotal: ${formatSize(total)}\nUsed: ${formatSize(used)}\nFree: ${formatSize(available)}" } android utility
Have you built a utility app before? Share your favorite tool or feature in the comments below! Happy coding! 🚀
dependencies { implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.appcompat:appcompat:1.6.1") implementation("com.google.android.material:material:1.11.0") implementation("androidx.constraintlayout:constraintlayout:2.1.4") } Utility apps often need access to storage, battery stats, or external files. For our cache cleaner, add this to AndroidManifest.xml : <uses-permission android:name="android
<Button android:id="@+id/btnStorageInfo" android:text="Analyze Storage" ... />
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <Button android:id="@+id/btnClearCache" android:text="Clear App Cache" ... /> Step 3: Build the Main UI Create a simple activity_main
Add these dependencies in your build.gradle.kts (Module):