Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 changes in Eclipse. 2. In the meantime screen goes off or not. 3. I run "debug" and want force screen to wake up.

I found a method with "power key" emulation but it does not turn it on but rather toggles the power state. I do not want to add extra code to my application. What are the other methods to do such trivial task, please help.

like image 607
Chameleon Avatar asked Feb 08 '13 12:02

Chameleon


People also ask

How do I enable ADB debugging on Android?

Enable adb debugging on your device To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom. On some devices, the Developer options screen might be located or named differently. You can now connect your device with USB.

How do I put my phone in adb mode?

Boot your phone into Android, then connect it to your desktop computer with a USB cable. On your computer, launch the Command Prompt and change the directory to point to the platform-tools folder. Type adb devices and hit Enter.

How do I run adb on my Samsung?

To use ADB with your Android device, you must enable a feature called “USB Debugging.” Open your phone's app drawer, tap the Settings icon, and select “About Phone”. Scroll all the way down and tap the “Build Number” item seven times. You should get a message saying you are now a developer.


1 Answers

adb shell input keyevent KEYCODE_WAKEUP 

As described here, this wakes up the device. Behaves somewhat like KEYCODE_POWER but it has no effect if the device is already awake.

To toggle sleep/wake with one command you can issue

adb shell input keyevent KEYCODE_POWER 
like image 66
boltup_im_coding Avatar answered Oct 03 '22 03:10

boltup_im_coding