How to turn off screen of android with terminal emulator? I am using Android 5.0.
1 Answer
There are two ways of doing this, depending on if you have root or not on your device.
If you use root
If you have rooted, run:
su
input keyevent 26
In any good terminal emulator.
If you have not rooted
If you haven't rooted, either root, or:
- Install ADB (Instructions vary between windows, Mac and Linux)
- Enable "USB Debugging in settings > developer options (if you cannot find developer options, tap the build number in 'about phone' seven times.)
- Connect your device to the PC, and connect via ADB
- Run:
adb shell input keyevent 26
-
-
@MBZXI If it works, please mark it as an answer (that tick under the downvote button) Commented Aug 9, 2016 at 17:48
input keyevent 26
. It's worth noting that the phone didn't accept this event, unless sent as root.