{"slug": "used-claude-to-make-a-screen-time-app-that-let-s-me-exclude-certain-apps", "title": "Used Claude to make a screen time app that let's me exclude certain apps", "summary": "A developer used Anthropic's Claude to build TrueScreenTime, a minimal Android app that reconstructs accurate foreground time from UsageEvents and lets users include or exclude specific apps from a custom screen time total. The app, written in Kotlin with XML layouts, features wellbeing-style charts, persistent filters, and a usage access flow, with unit tests running on the JVM via GitHub Actions.", "body_md": "A minimal Android app (Kotlin + XML layouts, no Compose) that reads device\nusage statistics and lets you build a **custom screen time total** by\nincluding/excluding individual apps.\n\n**Accurate foreground time**— reconstructed from`UsageEvents`\n\n(`MOVE_TO_FOREGROUND`\n\n/`MOVE_TO_BACKGROUND`\n\n/`ACTIVITY_STOPPED`\n\n) rather than the pre-bucketed`queryUsageStats()`\n\ntotals.**Wellbeing-style charts**— a donut chart of your included apps with the filtered total in the center (Today/Custom), and a weekly bar chart with hour gridlines and a tappable day selector (This Week). Both are small custom`View`\n\ns — no chart library.**Date ranges**— Today, This Week (Monday-based), or a custom start/end date picked from calendar dialogs.** Filterable app list**— every app with usage in the range is listed with its icon, name, and time, sorted descending. A checkbox on each row includes/excludes it from the big total, which updates live.**Exclusion list**— unchecking an app hides it from the list and leaves it out of the total. A dedicated** Excluded**screen lists everything you have excluded so you can restore apps individually or all at once, and a \"Show excluded apps\" toggle brings them back inline.**Persistent filters**— inclusion choices and the \"show system apps\" / \"show excluded apps\" toggles are stored in`SharedPreferences`\n\n.**System app toggle**— system apps and the launcher are hidden by default to reduce clutter.** Usage access flow**— if`PACKAGE_USAGE_STATS`\n\nisn't granted, the app shows an explanation and a**Grant Access** button that deep-links to`Settings.ACTION_USAGE_ACCESS_SETTINGS`\n\n.\n\n`./gradlew testDebugUnitTest`\n\n— everything runs on the JVM in about a\nminute; no device or emulator involved. GitHub Actions runs this job on\nevery push, and the APK is only built if it passes.\n\n| Layer | What it covers |\n|---|---|\n| Pure logic | `ForegroundSessionReplay` (session reconstruction from usage events), `WeekNavigator` (day/week stepping), `AppListFilter` (system/excluded filtering and totals), `DateRange` (midnight and week boundaries) |\n| Robolectric | `FilterStore` against real `SharedPreferences` , and a smoke test that launches every activity to catch inflation or view-binding failures the compiler cannot see |\n\nThe pattern is deliberate: logic that used to live inside the activities is extracted into plain Kotlin objects, so the interesting behaviour is testable without an emulator and the activities stay thin.\n\nRequirements: JDK 17+ and an Android SDK (compileSdk 35). Setting up from\nscratch on WSL2? See [BUILDING.md](/DaanyaalSobani/truescreentime/blob/claude/android-screentime-tracker-x58u19/BUILDING.md) for the exact commands.\n\n```\n./gradlew assembleDebug\n# output: app/build/outputs/apk/debug/app-debug.apk\n```\n\nOr grab the debug APK from the [Releases](/DaanyaalSobani/truescreentime/blob/releases) page — it is built\nby the GitHub Actions workflow in `.github/workflows/build.yml`\n\n.\n\n```\nadb install app/build/outputs/apk/debug/app-debug.apk\n```\n\nThen open the app and tap **Grant Access** to enable Usage Access.\n\nBecause the app is sideloaded, Android gates Usage Access behind \"restricted settings\" and the first attempt is denied. The full flow:\n\n| 1. Tap Grant Access | 2. First attempt is denied | 3. Allow restricted settings | 4. Turn the toggle on |\n|---|---|---|---|\n\nStep by step:\n\n- Open TrueScreenTime and tap\n**Grant Access**— it deep-links to the Usage Access settings, but the toggle is blocked at first (\"App was denied access\"). - Go to\n**Settings → Apps → TrueScreenTime**, open the**⋮** overflow menu in the top-right, and tap**Allow restricted settings**(you may be asked to authenticate). - Return to the app, tap\n**Grant Access** again, and enable**Permit access to app usage data**.\n\nThe grant is remembered until the app is uninstalled. The app never leaves the device with this data — everything stays local.\n\n- minSdk 24 (Android 7.0), targetSdk/compileSdk 35 (Android 15)\n- Dependencies: AndroidX core/appcompat/recyclerview/lifecycle, Material Components, Kotlin coroutines — nothing else.", "url": "https://wpnews.pro/news/used-claude-to-make-a-screen-time-app-that-let-s-me-exclude-certain-apps", "canonical_source": "https://github.com/DaanyaalSobani/truescreentime", "published_at": "2026-08-03 20:58:19+00:00", "updated_at": "2026-08-03 21:23:29.127672+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence"], "entities": ["Anthropic", "Claude", "TrueScreenTime", "GitHub Actions"], "alternates": {"html": "https://wpnews.pro/news/used-claude-to-make-a-screen-time-app-that-let-s-me-exclude-certain-apps", "markdown": "https://wpnews.pro/news/used-claude-to-make-a-screen-time-app-that-let-s-me-exclude-certain-apps.md", "text": "https://wpnews.pro/news/used-claude-to-make-a-screen-time-app-that-let-s-me-exclude-certain-apps.txt", "jsonld": "https://wpnews.pro/news/used-claude-to-make-a-screen-time-app-that-let-s-me-exclude-certain-apps.jsonld"}}