Skip to content

Repository files navigation

Service Keeper - Keep your Android services running

Android API Flutter Kotlin
Build Status Last Commit Issues
Stars Downloads
Release License: GPL v3

Features β€’ Screenshots β€’ Installation β€’ Setup β€’ FAQ β€’ Contributing


An Android app that monitors and automatically restarts background services killed by the system. Built with Flutter and powered by Shizuku for privileged shell access.

AI Disclosure: This project was built with significant AI assistance (Claude). All code has been reviewed and tested on a physical device (Android 16, API 36).

πŸ“‹ Table of Contents


✨ Features

Auto Restart
Auto Restart Services
Detects and restarts killed background services automatically
Scheduling
Flexible Scheduling
Configurable intervals from 5 min to 4+ hours per service
Audit Log
Complete Audit Log
Full timestamped history of every action and outcome
Accessibility
Accessibility Monitoring
Re-enables accessibility services when revoked
Notifications
Notification Listeners
Monitors and re-enables notification listeners
Boot
Boot Persistence
Auto-reschedules all monitors after reboot
App Relaunch
Smart App Relaunch
Restores your previous app after restart, with idle detection
Privacy
100% Private
No network permissions, no analytics, no ads, fully offline
Open Source
Free & Open Source
GPLv3 licensed, audit the code yourself

Key Capabilities

  • πŸ”„ Monitors background services β€” detects when a selected service is killed and restarts it automatically
  • β™Ώ Monitors accessibility services β€” re-enables them if Android revokes access in the background
  • πŸ”” Monitors notification listeners β€” re-enables if disabled by the system
  • ⏱️ Scheduled checks β€” configurable per-service interval (5 min to 4+ hours)
  • πŸ“ Audit log β€” full timestamped history of every detected stop, restart attempt, and outcome
  • πŸ” Boot persistence β€” reschedules all monitors after device reboot
  • πŸ“’ Per-app notifications β€” toggle restart alerts per service
  • 🎯 Smart app relaunch β€” when a service can only be recovered by relaunching its whole app, Service Keeper switches back to whatever you were doing afterward, and lets you control when that's allowed to happen (always, only when idle, only when locked, etc.)

πŸ“Έ Screenshots

Services List Service Details Accessibility Monitoring Notification Listeners

Settings Audit Log App Relaunch Settings Service Selection


πŸ“₯ Installation

Service Keeper is free and open source software, and is 100% offline (no network permissions, no analytics, no ads).

Download Options

Download Latest Release

Method Details Status
πŸ“¦ GitHub Releases Download APK directly (universal or ABI-specific) βœ… Available
πŸ”„ Obtainium Add https://github.com/sklndev/service_keeper as source βœ… Available
πŸ€– F-Droid Official F-Droid repository πŸ”œ Pending submission
πŸ“‹ IzzyOnDroid IzzyOnDroid F-Droid repo πŸ”œ Pending submission

Note: Metadata for F-Droid/IzzyOnDroid submission is available in fastlane/metadata/android.


βš™οΈ Requirements

Requirement Details
Android 8.0+ (API 26), tested on API 36
Shizuku Must be installed and running
ADB / Wireless Debugging Required to start Shizuku

Shizuku is a mandatory dependency. Without it, the app cannot execute privileged shell commands to restart services.


πŸš€ Setup

1. Install Shizuku

  1. Install Shizuku from the Play Store
  2. Enable Developer Options on your device
  3. Enable Wireless Debugging under Developer Options
  4. Open Shizuku β†’ tap Pair using Wireless Debugging and follow the prompts
  5. Shizuku should now show as Running

2. Install Service Keeper

Install from a release APK or build from source (see below). On first launch, grant Shizuku permission when prompted. The app displays a status banner at the top when Shizuku is inactive.

3. Add services to monitor

Tap + on the Services tab β†’ browse running services by app β†’ select what you want to keep alive.


πŸ”§ Building from Source

# Prerequisites: Flutter 3.x, Android SDK (minSdk 26, targetSdk 35)

git clone https://github.com/sklndev/service_keeper.git
cd service_keeper
flutter pub get
flutter run                          # debug on connected device
flutter build apk --release          # release APK
flutter build appbundle --release    # Play Store bundle

πŸ” Permissions

Permission Reason
FOREGROUND_SERVICE Background monitoring service
QUERY_ALL_PACKAGES Enumerate installed services for the picker
POST_NOTIFICATIONS Restart event alerts
RECEIVE_BOOT_COMPLETED Restore monitors after reboot
WAKE_LOCK + REQUEST_IGNORE_BATTERY_OPTIMIZATIONS Prevent Doze from deferring checks

πŸ› οΈ How it Works

Shizuku bridge All privileged operations go through a single MethodChannel (com.shaunkleyn.service_keeper/shizuku). Kotlin receives calls, spawns a Shizuku process, runs the shell command, and returns stdout to Dart.

Shell commands used:

  • dumpsys activity services [pkg] β€” detect running services
  • am start-foreground-service -n pkg/.Class β€” restart a service
  • am force-stop pkg β€” hard stop before restart

Scheduling

  • Interval β‰₯ 15 min β†’ WorkManager periodic task (battery-efficient)
  • Interval < 15 min β†’ self-chaining one-off tasks (re-schedules itself after each run)
  • BootReceiver restores all schedules from SharedPreferences on BOOT_COMPLETED

Service detection Parses dumpsys activity services output with a regex that handles both standard and Android 16 output format (which appends c:<caller> before }).

App relaunch and idle detection When a service can only be recovered by relaunching its whole app, Service Keeper captures the currently foregrounded app first, launches the target, waits briefly, then switches back to what you were on. Whether that's allowed to happen right away depends on the configured mode:

  • No app open: compares the foreground app against the resolved launcher/home package
  • No activity for a while: reads PowerManager's activity timer straight from dumpsys power, since taps and scrolls reset that timer directly, unlike UsageEvents, which doesn't fire reliably during ongoing scrolling
  • When locked: checks KeyguardManager.isKeyguardLocked, and defers via a small queue that drains on the next ACTION_USER_PRESENT broadcast

A blocked relaunch is queued and retried automatically once the device becomes idle, so nothing silently gets skipped.


πŸ’» Tech Stack

  • Flutter β€” UI and app logic
  • Kotlin β€” Android native bridge (Shizuku, WorkManager, icon/name lookup)
  • Shizuku β€” Privileged shell execution without root
  • WorkManager β€” Background task scheduling
  • sqflite β€” Audit event persistence
  • flutter_local_notifications β€” Restart alerts
  • palette_generator β€” Dynamic app colors extracted from icons

❓ FAQ

Does this app require root access?

No! Service Keeper uses Shizuku for privileged access, which doesn't require root. Shizuku can be started via wireless debugging (ADB) on any Android device.

Will this drain my battery?

Battery usage is minimal. Service Keeper uses WorkManager for efficient background scheduling and only performs lightweight checks at configurable intervals (5min-4hrs). The app respects Android's Doze mode while preventing check deferrals with wake locks.

Why do I need Shizuku?

Android's security model prevents regular apps from restarting services or re-enabling accessibility services. Shizuku provides a bridge to execute these privileged operations without requiring root access.

Does this collect any data?

No. Service Keeper has zero network permissions and operates 100% offline. All data stays on your device. You can verify this in the source code or by checking the app's permissions.

Can I monitor system services?

Service Keeper focuses on third-party app services. System services are managed by Android itself and generally shouldn't need external monitoring.

What happens if Shizuku stops running?

The app will display a banner notification and won't be able to restart services until Shizuku is restarted. Scheduled checks continue running and will resume operations once Shizuku is available.

Does this work with all apps?

Most apps work fine, but some apps with aggressive self-protection or special system configurations may not respond to standard restart commands. The audit log will show any failures.


πŸ› Troubleshooting

Shizuku won't stay running

Solution: Enable Start on Boot in Shizuku settings. If your device has aggressive battery optimization, add Shizuku to the battery optimization whitelist.

Services aren't being restarted

  1. Check Shizuku status β€” ensure it's running (green banner in Service Keeper)
  2. Review audit log β€” check for error messages explaining why restart failed
  3. Verify service is actually stopped β€” use Settings β†’ Developer Options β†’ Running Services
  4. Try manual restart β€” tap the refresh button in Service Keeper to force a check
  5. Increase check interval β€” some services may need time to stabilize before monitoring

App keeps crashing

  1. Update to latest version β€” check Releases
  2. Clear app data β€” Settings β†’ Apps β†’ Service Keeper β†’ Storage β†’ Clear Data
  3. Check Android version β€” minimum API 26 (Android 8.0) required
  4. Report the issue β€” open a GitHub issue with crash details

Battery optimization warnings

Service Keeper needs to run in the background. If your device aggressively kills background apps:

  1. Disable battery optimization for Service Keeper (Settings β†’ Battery β†’ Battery Optimization)
  2. Add to auto-start whitelist (varies by manufacturer)
  3. Lock app in recents (available on some devices)

Wireless debugging disconnects frequently

Some devices disconnect wireless debugging when the screen is off. Solutions:

  1. Use USB debugging instead of wireless (requires cable to start Shizuku each boot)
  2. Root and use Shizuku in root mode (if you prefer root)
  3. Enable "Stay awake" in Developer Options when starting Shizuku

πŸ—ΊοΈ Roadmap

Planned features and improvements:

  • Export/import monitoring configuration β€” backup and restore your service list
  • Per-service success/failure statistics β€” track reliability over time
  • Custom restart commands β€” advanced users can specify alternative restart methods
  • Tasker/automation integration β€” trigger monitoring via external events
  • Widget support β€” quick status view and manual trigger from home screen
  • Dark theme variants β€” multiple AMOLED-friendly themes
  • Notification grouping β€” better organization for multiple service alerts
  • Advanced filtering in audit log β€” search by service, time range, outcome
  • Service dependency chains β€” automatically restart dependent services in order
  • F-Droid listing β€” official F-Droid and IzzyOnDroid availability

Have a feature request? Open an issue with the enhancement label!


🀝 Contributing

Contributions are welcome! Here's how you can help:

Ways to Contribute

  • πŸ› Report bugs β€” open an issue with detailed steps to reproduce
  • πŸ’‘ Suggest features β€” share your ideas in the issues
  • πŸ“ Improve documentation β€” fix typos, clarify instructions, add examples
  • 🌍 Translate β€” help localize the app (currently English only)
  • πŸ’» Submit code β€” fork, make changes, and open a pull request

Development Setup

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/Service-Keeper.git
  3. Create a feature branch: git checkout -b feature/amazing-feature
  4. Make your changes and test thoroughly on a physical device
  5. Commit with clear messages: git commit -m 'Add amazing feature'
  6. Push to your fork: git push origin feature/amazing-feature
  7. Open a Pull Request

Code Style

  • Follow existing Dart/Kotlin conventions
  • Add comments for complex logic
  • Test on physical devices (emulators don't support Shizuku)
  • Update documentation if needed

Testing

All changes should be tested on a real Android device with Shizuku before submitting.


πŸ’– Support

If you find Service Keeper useful, please consider:

Star this repo

  • ⭐ Star the repository β€” helps others discover the project
  • πŸ› Report bugs β€” help improve stability
  • πŸ’‘ Share feature ideas β€” guide future development
  • πŸ“’ Spread the word β€” tell others who might benefit
  • 🀝 Contribute code β€” PRs are always welcome!

Acknowledgments

  • Shizuku β€” for making privileged operations possible without root
  • Claude (Anthropic) β€” AI pair programming assistant used during development
  • Flutter & Kotlin communities β€” for excellent frameworks and tools

πŸ€– AI Disclosure

This project was prototyped and developed with heavy use of Claude (Anthropic). The development approach is commonly called "vibe coding" β€” iterating rapidly with an AI pair programmer. All generated code was tested on a physical device before shipping. If you find bugs, open an issue.


πŸ“„ License

GNU General Public License v3.0 or later

Copyright Β© 2025 Shaun Kleyn

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

Made with ❀️ and πŸ€– β€’ Report Bug β€’ Request Feature

Built with Flutter β€’ Powered by Shizuku β€’ Enhanced by Claude

About

Android app that monitors and automatically restarts background services, accessibility services, and notification listeners killed by the system, using Shizuku for privileged access.

Topics

Resources

Contributing

Stars

32 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages