How do I keep my screen unlocked during USB debugging?

前端 未结 19 1318
清酒与你
清酒与你 2020-12-13 07:55

Android OS2.2 used to have an option under Settings/Applications/Development to disable screen lock during USB debugging. After upgrading my Samsung Galaxy S to OS2.3.3 this

19条回答
  •  借酒劲吻你
    2020-12-13 08:50

    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:

    1. I saved the script to the default use location - /Users/[your username]
    2. Given executable access to the file - chmod +x ~/cell-screen.sh
    3. Whenever I start my development tasks, I just execute the shell script in terminal - ~/cell-screen.sh on
    4. 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

提交回复
热议问题