i want to set screen time out within my app.Is there any way to adjust screen timeout or sleep mode on/off ?
1 Answer, 1 is accepted
0
Tina Stancheva
Telerik team
answered on 17 Mar 2015, 08:54 AM
Hi Anushika,
I am not sure that I understand exactly your requirement. However, when it comes to controlling the screen dimming or screen lock in a hybrid Cordova application, there are a couple of plugins you can use:
Telerik Verified Insomnia plugin allows you to prevent the screen from dimming (and locking the device) while the user is not touching the screen.
PowerManagement plugin which offers access to the devices power-management functionality. It should be used for applications which keep running for a long time without any user interaction. You can import it in an AppBuilder project following these instructions and you can also have a look at this forum thread where you will find a sample project demonstrating the plugin's functionality.
Further, the Cordova API exposes two events related to the app's state:
pause: the event fires when the native platform puts the application into the background, typically when the user switches to a different application.
resume: the event fires when the native platform pulls the application out from the background.
Let me know if this information helps and if you have more questions.