How to Prevent an Android Device from Sleeping via ADB Command

In this guide, we will show you the ADB Commands to prevent an Android device from sleeping. If you are a developer testing out a few things but the device tends to go to sleep after a few minutes, then it could lead to quite an infuriating experience apart from the break in the workflow.

In this regard, you have the option to change the time after which the device goes to sleep, but in most devices, the maximum time is 30 minutes, which might not be sufficient for most of you. So, is there a way to expand this time limit? Well, there is one, and in this guide, we will show you how to do just that. So without further ado, let’s get started.

  • How to Prevent an Android Device from Sleeping via ADB Command
  • How To Revert To The Default Setting
  • How to Prevent an Android Device from Sleeping ‘Without’ ADB Command

How to Prevent an Android Device from Sleeping via ADB Command

How to Prevent an Android Device from Sleeping via ADB Command - 1
  1. Download and extract the Android SDK Platform Tools on your PC.
  2. Now enable USB Debugging and connect your device to PC via USB.
  3. Open Command Prompt inside the platform tools folder and type in adb shell settings put global stay_on_while_plugged_in 3
  4. Likewise, you may also use the below command to get this job done: adb shell svc power stayon true
  5. NOTE: You might have to keep your device plugged in for these commands to work.

How To Revert To The Default Setting

After executing either of the two above commands, your device will never sleep. So it’s highly recommended to bring your device back to its default sleep settings once you are done with the task. Here’s how it can be done:

  • If you had used the adb shell settings put global stay_on_while_plugged_in 3 command, then type in the below command: adb shell settings put global stay_on_while_plugged_in 0
  • On the other hand, if you had used the adb shell svc power stayon true command, then execute the below-given command: adb shell svc power stayon false

How to Prevent an Android Device from Sleeping ‘Without’ ADB Command

Yes, there does exist a method to get this job done without ADB Commands, and trust us, it’s the easier and shorter one when compared with its counterpart. The command that we had used earlier adb shell svc power stayon true is just the equivalent of setting to keep the device awake while plugged in . So you can simply enable this toggle in one go and achieve the same result that the ADB Command gave you. To do so, just head over to Settings > System > Developer Options > Enable Stay Awake.

stay awake developer options android - 2 stay awake developer options android - 3
  • How to Enable Allow From Unknown Sources via ADB Commands
  • How to Install, Uninstall, Send Apps on RayNeo X2 [ADB Commands]
  • ADB Error Failed to Copy: No Space Left on Device [Fix]
  • Edit Touch and Hold Delay Timings on Android via ADB Commands
Google preferred - 4 Google preferred - 5

(Cancel Reply)

Δ