Skip to content

RekaApps/autodnd

Repository files navigation

AutoDND

Automatically enable Do Not Disturb when selected apps are opened.

AutoDND is a lightweight, privacy-focused Android app that monitors which app is in the foreground and toggles Do Not Disturb mode accordingly. No analytics, no tracking, no internet required.


Features

  • Per-app DND control — select any installed app to trigger DND when opened
  • Three DND modes — Total Silence, Priority Only, or Alarms Only
  • Persistent monitoring — foreground service survives screen off and app switching
  • Boot resilience — automatically restarts after device reboot or app update
  • DND flicker prevention — switching between two monitored apps keeps DND active
  • Battery efficient — 1-second polling using UsageStatsManager events (no Accessibility Service)
  • Material 3 UI — clean, native Android look following Google design guidelines
  • Zero tracking — no analytics, no telemetry, no internet permission

Permissions

Permission Why it's needed
PACKAGE_USAGE_STATS Detect which app is currently in the foreground
ACCESS_NOTIFICATION_POLICY Enable and disable Do Not Disturb mode
FOREGROUND_SERVICE Keep monitoring service alive in the background
RECEIVE_BOOT_COMPLETED Restart monitoring after device reboot
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS Optional — improves reliability on aggressive OEMs

No INTERNET permission is declared. All processing happens on-device.


Architecture

app/
└── src/main/java/com/rekaapps/autodnd/
    ├── data/
    │   ├── database/       # Room entities & DAO
    │   ├── preferences/    # DataStore preferences
    │   └── repository/     # AppRepository
    ├── domain/
    │   ├── model/          # MonitoredApp, DndMode
    │   └── usecase/        # DndManager, AppMonitor
    ├── ui/
    │   ├── apps/           # Apps screen + ViewModel
    │   ├── settings/       # Settings screen + ViewModel
    │   ├── about/          # About screen
    │   └── theme/          # Material 3 theme
    ├── services/           # AppMonitorService (foreground)
    ├── receivers/          # BootReceiver
    ├── permissions/        # PermissionChecker
    └── di/                 # Hilt modules

Tech stack: Kotlin · Jetpack Compose · Material 3 · MVVM · Hilt · Room · DataStore · Coroutines/Flow


Build Instructions

  1. Clone the repository:
    git clone https://github.com/rekaapps/autodnd.git
  2. Open in Android Studio Hedgehog (or newer).
  3. Sync Gradle and run on a device or emulator running Android 10 (API 29)+.

Note: UsageStatsManager requires a real device or an emulator with usage stats populated. Grant Usage Access and DND Access in the app's Settings screen before starting the service.


License

MIT — see LICENSE.

Packages

 
 
 

Contributors

Languages