In HTML5, how can I keep an Android device’s screen on?
android, html
Solution
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`:
`getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);`
Problem
We are developing an App in HTML5 using jQuery. Is there a way/method, in JavaScript or another technology, to keep the screen "on"?