Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable screen timeout Android phone/tablet

Tags:

android

sleep

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.

like image 616
questions Avatar asked Dec 01 '22 09:12

questions


1 Answers

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);
like image 129
neteinstein Avatar answered Dec 21 '22 04:12

neteinstein