🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mobile.android
Article #383

Re: FAQ: PSA: Tutorial: Walk-Thru etc. Random examples of using adb with Android

#383
From: Maria Sophia
Date: Sat, 24 Oct 2026 14:03
49 lines
2988 bytes
Maria Sophia wrote:
> And I needed to take a screenshot of the date and time, but the phone was 
> tucked away somewhere (since I mirror onto my Windows monitor at home).
> 
> I needed a way to bring the phone to the lock screen w/o touching it.
>  adb shell input keyevent 26
>       
> That sent a power button event,turning the screen off & locking the phone.
> 
> Then, this awoke the phone, which gave me the clock lock screen I needed.
>  adb shell input keyevent 224
> 
> Voila!
> 
> With adb I was able to both lock & unlock the phone for the screenshots.

Also, plenty of apps on the phone will blank the screen, using adb.

 # in ladb on the phone
  adb shell input keyevent 223

 # in Termux, on the phone (pkg install android-tools)
   adb pair <phone-ip>:<pair-port> 
   adb connect <phone-ip>:<port>
   adb shell input keyevent 223

.# In Termux, with Shizuku remote interactive shell 
   rish -c "input keyevent 223". 

Or, if a desktop is handy (the phone can be on Wi-Fi or USB).

1. Blank the screen (sleep, no lock)
   adb shell input keyevent 223
   -> KEYCODE_SLEEP, turns the display off

2. Wake up the screen
   adb shell input keyevent 224
   -> KEYCODE_WAKEUP

3. Sleep & lock (same as pressing power)
   adb shell input keyevent 26
   -> KEYCODE_POWER

4. Let it fall asleep on its own over a given time
   adb shell settings put system screen_off_timeout 1000
   adb shell svc power stayon false
   -> short timeout, then normal sleep behavior
-- 
Every post to Usenet should strive to add value that wasn't there.
Technical Details
Message-ID: <11bidr8$2dvj$1@nnrp.usenet.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED.p847012-ipxg03601okidate.aomori.ocn.ne.jp!not-for-mail
References: <11a96gn$b36$1@nnrp.usenet.blueworldhosting.com> <11bau61$jic$1@nnrp.usenet.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED.p847012-ipxg03601okidate.aomori.ocn.ne.jp!not-for-mail
From: Maria Sophia <mariasophia@comprehension.com>
Newsgroups: comp.mobile.android
Subject: Re: FAQ: PSA: Tutorial: Walk-Thru etc. Random examples of using adb with Android
Date: Sat, 24 Oct 2026 10:03:20 -0400
Organization: BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID: <11bidr8$2dvj$1@nnrp.usenet.blueworldhosting.com>
References: <11a96gn$b36$1@nnrp.usenet.blueworldhosting.com> <11bau61$jic$1@nnrp.usenet.blueworldhosting.com>
Reply-To: pusvul@getTjewytR4so+mqe2.invalid
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 24 Oct 2026 14:03:20 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com; posting-account="l//KxG3Ge2LojWvwJg0Igv8F0ChK8RUC9RtOxMPUo3U"; posting-host="kDFbMLCayXSZqkA/GNCfbb/6QVvqMRZJtdlXDNEuzKE";
	logging-data="79859"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Mojibake 1p3
Cancel-Lock: sha1:xRSjaPN/TUE+RGpnf04vEv70aHM= sha256:/CmIpDbDrC3QQLzo2t1WMR+j0srh2xD/DgvgtLlObhs=
	sha1:smN7daUOEB7uzahHIE+7Uxlj3ZM= sha256:UJ077EYlFQNMqxgHlejMWjtIQo1NQC9cwlFOK8iuRO0=
Content-Language: en-GB