Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I let Android device go to "sleep" while debugging?

Tags:

android

I was recently debugging a problem relating to the device going into sleep mode and changing activities. (Android changes activity when it goes to sleep) Luckily I got the solution without using the debugger, but if I had needed the debugger I don't know how to do that.

The device (Samsung Galaxy Player, Android 2.36) has the display timeout set to 30 seconds, and if it's not attached to USB the screen goes black in 30 seconds.

But if it is attached to USB it gets dimmer after 30 seconds but it never goes black and the Activity on the screen still remains active and responsive. But I need to attach it to USB to debug it.

How, (either programmatically or through some Android setting) can I let my Android device go to sleep normally when it's attached to the debugger so I can use the debugger to investigate Activity life-cycle events associated with sleep/idle states?

My development environment is Eclipse Indigo, Android Development Tools 22.0.1.v201305230001--685707, Windows 7.

like image 347
user316117 Avatar asked Sep 16 '25 03:09

user316117


1 Answers

There is an option which does the opposite of what you want, so you could see if that's checked.

Under Developer options in the Android Settings panel, look for the third item, entitled Stay awake (Screen will never sleep while charging).

Android Developer options screen with “stay awake” option highlighted

like image 112
Jeremy Avatar answered Sep 18 '25 19:09

Jeremy