Let's build a Firefox extension with Kotlin

Implement Android Prevent Screen Off library?

Android prevent screen off is the library that keeps the screen on until user is looking at the screen. If you are using Samsung devices you might know there is one feature called “Smart Stay”.
 
When this feature is enabled, the device will prevent your screen from turning off regardless of your screen timeout settings. But, this technology is only available on some Samsung devices. What if we want to use that technology in our application to solve above problem?
Today, I am going to present the solution of this problem.
Here is the solution:
Prevent-Screen-Off” library handles screen on/off timing smartly. It prevents device display from turning off when the user is looking at the screen and he/she might be reading some textual content provided by your application. As soon as the user stop looking at the screen it will allow phone screen to turn off.
What is Android prevent screen off library for?
  • Ideally, when you user is looking at the screen, your application should not turn the screen off. This is huge deal for the blogging, messaging applications because those applications displays textual content to the user. Reading those textual content takes more time to the user. While reading that content (let say anu article) if the screen turns off, because of the screen timeout that is frustrating to the user.
  • This library provides smart handling of the screen on-off. This library prevents screen from turning off if your user is looking at the screen might reading some textual content on the screen. As soon as the user stop looking at the screen it will allow phone screen to turn off.
Source: What and How implement Android Prevent Screen Off?

Comments