The Screen Wake Lock API should be used to keep the screen on to benefit usability. It is good practice to store a reference to the sentinel object to control release later and also to reacquire the lock if need be. It can also be released manually via the WakeLockSentinel.release() method. It can be released by the system, again if the battery power is too low or the document is not active or visible. The sentinel is attached to the underlying system wake lock. A request may be rejected for a number of reasons, including system settings (such as power save mode or low battery level) or if the document is not active or visible. You acquire a WakeLockSentinel object by calling the () Promise-based method that resolves if the platform allows it. There are plenty of use cases for keeping a screen on, including reading an ebook, map navigation, following a recipe, presenting to an audience, scanning a QR/barcode or applications that use voice or gesture control, rather than tactile input (the default way to keep a screen awake). Only visible (active) documents can acquire the screen wake lock. It allows for a simple platform-based solution which up until now could only be achieved via workarounds which were potentially power hungry. ![]() The Screen Wake Lock API prevents the screen from turning off, dimming or locking. Whilst this is a useful feature, some applications need the screen to stay awake to be their most useful. ![]() Modern devices do this to save on battery power. Most devices by default turn off their screen after a specified amount of time to prolong the life of the hardware.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |