4

I want to completely disable the screen timeout. You can set a anti sleep in your application code, but it wont disable the auto sleep of Android that you can set from 15 sec to 30 min, also the programs that i downloaded from the market cant disable the 30 min auto screen sleep limit.

I want to run a AJAX webpage in the browser that has to be visible at all times, its connected to power, so power is no issue.

Rich Schuler
  • 41,814
  • 6
  • 72
  • 59
questions
  • 41
  • 1
  • 1
  • 2

3 Answers3

16

There is a XML way that Google recommends:

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:keepScreenOn="true">

Check http://www.google.com/events/io/2009/sessions/CodingLifeBatteryLife.html slide 16.

Or

getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
neteinstein
  • 17,529
  • 11
  • 93
  • 123
4

Take a look at this * (warning * link to expensive course) Also this (FREE Google tutorial - use this link) can be helpful.

Hope this helps.

Community
  • 1
  • 1
Harry Joy
  • 58,650
  • 30
  • 162
  • 207
0

Go to about tablet or about phone in your device settings, go to build number, tap build number rapidly 7 times to enable developer options, click back button, open developer options, click stay awake and you are now done; your screen will never sleep. Be smart and don't play around in developer options, you can very easily destroy your device.