4

How to turn off screen of android with terminal emulator? I am using Android 5.0.

5
  • In ADB, try 'adb shell input keyevent 26' (no ' marks)
    – Dan Brown
    Commented Aug 5, 2016 at 18:00
  • 1
    @DanB From an in-Android Terminal emulator, it's just input keyevent 26. It's worth noting that the phone didn't accept this event, unless sent as root.
    – Grimoire
    Commented Aug 5, 2016 at 20:13
  • @DeathMaskSalesman Ah OK. I was not sure at what point to shorten it to.
    – Dan Brown
    Commented Aug 5, 2016 at 20:24
  • @DanB Your version is perfect for use from adb, and it may also avoid the user to be root.
    – Grimoire
    Commented Aug 5, 2016 at 20:27
  • @DeathMaskSalesman Yes, which is why I suggested it in the first place. I left it as a comment because its too blunt/short for an answer.
    – Dan Brown
    Commented Aug 5, 2016 at 20:36

1 Answer 1

6

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:

  1. Install ADB (Instructions vary between windows, Mac and Linux)
  2. Enable "USB Debugging in settings > developer options (if you cannot find developer options, tap the build number in 'about phone' seven times.)
  3. Connect your device to the PC, and connect via ADB
  4. Run: adb shell input keyevent 26
2
  • Thaaaaaaaaaaaaaaaaaank's its work 5/5 :)
    – MBZ XI
    Commented Aug 9, 2016 at 17:36
  • @MBZXI If it works, please mark it as an answer (that tick under the downvote button)
    – Dan Brown
    Commented Aug 9, 2016 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .