1

I want to set the screen to turn off during a video from the gallery if there are something about 30 seconds without any touch, How can I do that? Is root necessary?

My android version is 9.0.

  • I believe you can do it through an adb shell without root. However, the way I know of you have to manually input the commands. I do not know how to set a timer. I believe the power button is keyevent 26. Try opening an elevated command prompt and with adb throw the command: adb shell input keyevent 26 that should press the power button and hopefully turn of the screen. Then throw the command again to turn it on. – Bo Lawson Jan 13 at 1:48
  • So you mean that I need to try that line of code to check if the power button is keyevent 26? – HNWeb Jan 13 at 3:30
  • Yes, it might work depending on your android version. You need to invoke an adb shell with the shell send the command input keyevent 26 which should simulate a power button push shutting of the screen. – Bo Lawson Jan 13 at 3:43
  • What do you mean when you say "it might work depending on your android version"? – HNWeb Jan 13 at 3:53
  • My android version is 9.0, would it cause different code? – HNWeb Jan 13 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.