📱 ADB Keep Screen On




A small CLI tool that keeps your Android device's screen awake while it is connected over ADB. Not tied to the charging state, just the ADB connection.
Useful during debugging, automation, and demos where you want the screen on without touching the device or digging through developer settings.
Why this exists
Android has a "Stay awake while charging" developer option, but that is broader than most workflows need. A more precise "Stay awake while ADB is connected" option has been requested since 2016 and is still unresolved:
Google Issue Tracker #37094654
This tool watches the ADB connection and toggles the setting only while a device is connected.
Features
- Handles multiple devices at once, physical and emulators.
- Stores each device's original setting and restores it on exit.
- Wakes the screen when it enables the stay-awake setting.
- Polls
adb devices and reacts to connects and disconnects automatically.
- Configurable through a JSON file: poll interval, wake-on-connect, restore-on-disconnect, and a device allowlist.
- Subcommands for
stop, status, version, and help.
Install
One-liner (macOS / Linux / Windows Git Bash)
curl -sfL https://github.com/nisrulz/adb-keep-screen-on/releases/latest/download/install.sh | sh
No Go needed. The script picks the right binary for your OS and puts it in /usr/local/bin (Unix) or ~/bin (Windows Git Bash).
Go install
go install github.com/nisrulz/adb-keep-screen-on@latest
Requires Go 1.26+.
Build from source
git clone https://github.com/nisrulz/adb-keep-screen-on.git
cd adb-keep-screen-on
make build
Requires ADB on your PATH.
Usage
adb-keep-screen-on # Start daemon (runs in background)
adb-keep-screen-on stop # Stop the daemon
adb-keep-screen-on status # Show whether the daemon is running
adb-keep-screen-on --foreground # Run in foreground (debug)
adb-keep-screen-on version # Print the version
adb-keep-screen-on help # Show usage help
❯ adb-keep-screen-on
✅ Started (PID 41234)
❯ adb-keep-screen-on --foreground
🔌 Monitoring ADB connection to keep the screen awake
✅ Connected: DEMOR1A04321: screen will stay awake
🔌 Disconnected: DEMOR1A04321
^C
Configuration
On first run, a config file is created at ~/.adb-keep-screen-on/config.json with sensible defaults. You can customize poll interval, wake-on-connect behavior, restore-on-disconnect, and set an allowlist of specific devices. See docs/configuration.md for details.
Docs
License
Apache License Version 2.0 © Nishant Srivastava