Mrgoos Mrgoos - 1 year ago 135
Android Question

In HTML5, how can I keep an Android device’s screen on?

We are developing an App in HTML5 using JQuery.

Is there a way/method, in JavaScript or another technology, to keep the screen "on"?


10s 10s
Answer Source

There is no way to ONLY write javascript or other web code to keep the screen on, without writing at least a little java code.

To explain why I am so certain, if you are developing a web app through html5 you MUST use a WebView as the main "screen" of your application to host your html,javascript code. So your "web code" does not directly run in the application but uses a View as its holder. As you can guess you can't just lock the screen from some code that is not even running in the native part.

I can provide a very easy and simple way to keep the screen on if you are not an expert in android programming. In the first activity, that uses the WebView I guess, add in onCreate after super:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download