I created simple shell script for my macOS
File Name : cell-screen.sh
#!/bin/sh
echo '`cell-screen on` to keep the screen on during usb debugging'
echo '`cell-screen off` to reset'
echo ''
echo 'your parameter - ' $1
if [[ "$1" = "on" ]]; then
~/Library/Android/sdk/platform-tools/adb shell settings put global stay_on_while_plugged_in 2
elif [[ "$1" = "off" ]]; then
~/Library/Android/sdk/platform-tools/adb shell settings put global stay_on_while_plugged_in 0
else
echo '\n[****]Bad Input.'
fi
echo '\nEnd'
Steps:
- I saved the script to the default use location -
/Users/[your username]
- Given executable access to the file -
chmod +x ~/cell-screen.sh
- Whenever I start my development tasks, I just execute the shell script in terminal -
~/cell-screen.sh on
- After I complete my development work, I simply execute -
~/cell-screen.sh off
For Windows Users:
Change the shell script for the adb location - %LOCALAPPDATA%\Android\sdk\platform-tools\adb