A focused Android application for managing app access through scheduled modes and NFC-based controls.
Idea is simple, create mode -> select apps to be blocked/allowed -> set schedule for this mode (optional (example: morning focus time)) -> add NFC tag linked to this mode (optional (example: physical tag on your desk)) -> activate mode manually/by schedule -> put NFC tag, if linked away -> stay focused -> grab nfc tag when you need to use blocked apps.
If no NFC tag is linked to the mode, you can deactivate it using any NFC tag (smart watch, most headphones, etc...)
Main core of idea: you are not able to unlock mode without physical interaction using NFC tag.
Guardian allows you to define blocking modes that restrict access to selected applications. Modes can be activated manually, through time-based schedules, or deactivated using NFC tags. The app runs as a persistent foreground service to ensure reliable blocking even when the device is locked or the app is closed.
Create blocking modes with two operational patterns:
- Block Selected: Blocks access to specified applications
- Allow Only: Blocks all applications except those specified
Each mode can optionally require a specific NFC tag for deactivation.
Configure time-based activation of modes with:
- Per-day time configuration (start/end times can vary by day)
- Optional automatic deactivation at end time
- Multiple mode linking per schedule
- Register NFC tags for mode-specific unlocking
- Tap any registered tag to deactivate active modes
- Optional: Require specific tags for individual modes
- Android 6.0 (API 23) or higher
- NFC hardware (for NFC unlock functionality)
- Permissions required:
- Usage Access (to detect foreground apps)
- Display Over Apps (to show block screen)
- Battery Optimization exemption (for reliable background operation)
Built with:
- Kotlin
- Jetpack Compose for UI
- Kotlin Coroutines for background operations
- Kotlinx Serialization for state persistence
- AlarmManager for precise schedule execution
The app uses a foreground service pattern to maintain blocking functionality across system events including device reboots and task removal.
- Clone the repository
- Open in Android Studio
- Build and run on device (emulator NFC support is limited)
Some manufacturers aggressively kill background services. After installation:
- Open system Settings → Apps → Guardian
- Disable "Pause app activity if unused"
- Enable "Autostart" if available
- Set battery optimization to "No restrictions"
App state is stored in SharedPreferences. Schedule disablement flags are date-stamped and persist only for the current day.
This project has MIT License.
Contributions are welcome!
Claude Ai was used during the development of this project for writing code snippets and styling.
