Wake up Android with use adb or Eclipse (just before debug)?

后端 未结 9 644
温柔的废话
温柔的废话 2021-01-31 04:45

How to wake up Android with use adb - I want to wake up (if asleep) Android terminal before debugging every new version of application.

Typical flow is: 1. I do some cha

9条回答
  •  故里飘歌
    2021-01-31 04:57

    For Windows and Eclipse you can use .bat file:

    @ECHO OFF
    setlocal
    for /f "delims= tokens=1*" %%a in ('adb shell dumpsys power ^| findstr.exe "mScreenOn="') DO (
    for /f "delims== tokens=2*" %%S in ("%%a") do (
    if "%%S" == "false" (goto move1) else (goto move2)
    )
    )
    
    :move1
    adb shell input keyevent 26
    goto end
    
    :move2
    goto end
    
    :end
    exit
    

    It will check, if screen is off it will switch the power state. To use it with Eclipse this .bat file should be used as "External tool" (just fill the path to the .bat) and linked to the project in it's properties (Builders - Import - ).

提交回复
热议问题