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开发者_StackOverflow 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.
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);
Take a look at this * (warning * link to expensive course) Also this (FREE Google tutorial - use this link) can be helpful.
Hope this helps.
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.
精彩评论