0

Hi, I'm new to Android development (please excuse me for this elementary question) and am currently developing a simple app. However, when I run the app, the screen stays on unless I exit the app.

When running most other apps, the phone screen will automatically turn off after several minutes. How can I set it so that the screen automatically turns off after running my app after idling for some time?

Thanks

Simon
  • 14,407
  • 8
  • 46
  • 61
user2465411
  • 21
  • 1
  • 6
  • Are you running the app on emulator or on a device? – Steve Benett Jul 25 '13 at 20:35
  • Try this. On the device you're running: Setting -> Applications -> Development and turn off Stay awake if it's turned on. – Ivan Skoric Jul 25 '13 at 20:45
  • You don't need to mention Eclipse. Eclipse is just a tool for building applications. This is an Android question. I've edited the title. – Simon Jul 25 '13 at 20:56
  • To clarify, I'm actually running the apk on a device. (not testing in usb debug...etc. The app has already been published) – user2465411 Jul 26 '13 at 01:51

1 Answers1

2

Uncheck the Stay awake in Settings->Developer Settings.

swist
  • 1,111
  • 8
  • 18
  • To clarify, I'm actually running the apk on a device. (not testing in usb debug...etc. The app has already been published) Do happen to know how I can fix this? Thanks. – user2465411 Jul 26 '13 at 18:17
  • This operation should be performed on a device. But I thought that by "running in debug" you mean connected to usb. If this is not the case then the only solution I can think of is that you (or any lib you use) do [this](http://stackoverflow.com/questions/3723634/how-do-i-prevent-an-android-device-from-going-to-sleep-programmatically) – swist Jul 26 '13 at 19:19
  • Sorry for the confusion. My title was edited. I'm actually looking to do the opposite of what you posted. When the app is running and the phone idles for some time, the screen should turn off by itself, but for some reason, mine doesn't. (So the screen remains on unless I exit the app). Is there some sort of code that I have to implement in my activity? – user2465411 Jul 30 '13 at 02:17