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

前端 未结 5 1609
挽巷
挽巷 2020-12-06 05:37

We are developing an App in HTML5 using jQuery.

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

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 05:53

    Simplest method is to go to the Settings, Developer Options, and to select "Stay awake while charging". No need to code anything!

    This supposes that OP wants to keep the screen on while connected to an external power source, which is reasonable, otherwise no clever coding will prevent the screen from going off soon when the internal battery drains empty.

    The external power source can be as simple as a portable usb battery. When that eventually gets empty, the device will go to sleep as usual, but will remain functional on its internal battery.

    I found this solution here: posting about keeping the screen on

提交回复
热议问题