You might be wondering why on earth would someone want to control his Android phone using the ADB commands. Well, as long as all your device hardware keys are working fine and the touch screen panel works flawlessly, you won’t find the article of any use.. until the day arrives when one of the back or menu buttons go kaput. That’s when you’ll visit your bookmarks to look up this article (hint: bookmark this!).
I will be covering how you can control your Android using virtual hardware keys on some of the applications on your device later in a separate post. But before that I will have to make arrangements so that you can install those apps on your device even when the keys are not working. Come on, no one keeps such apps installed on their Android beforehand, right? This post is for the users who already have non-functioning Android hardware keys.
Before we continue, install Android SDK on your computer and enable ADB Platform tools. You can have a look at our article on Chrome for Android debugging where we have discussed it in the first two steps. Having done that, add the path of ADB files to Windows Environment Variables. If you don’t know how to do that, refer to out article on Windows keyword and have a look at steps 3 to 6. This makes sure you can use the ADB command throughout Windows. Also make sure that your device drivers are installed as well.
Also on Guiding Tech
Waking Up Phone.
Before we use any of the key events, you will have to wake up your phone first and with the power button not working, it would not be an easy task. Sadly I was not able to find any command that could wake the phone but you can always reboot your phone using the command adb reboot and once the phone reboots, use the following keypress events to install the applications.
Use Key Events
After the phone wakes up, you can use the following syntax to control: use the command adb shell input keyevent .
Just replace the keycode with the numbers corresponding to the events you would like to perform as mentioned in the table.
The above trick will help you if you have broken the hardware keys of your device. Don’t forget to tune in soon when we see how we can map virtual hardware keys on an Android phone even when the hardware keys are broken.