I don't know where to start. I am searching for this from yesterday but didn't got any idea.
I have a Cordova android app. It is working fine but if user is not doing anything then screen get locked and app will go to background/pause.
I want to keep the phone stay awake when app is running.
Is there any plugins/example for the same?
You can use this plugin in order to prevent device from falling asleep.
In order to achive that you can call this method:
window.plugins.insomnia.keepAwake()
And then, to enable it again, you have to use:
window.plugins.insomnia.allowSleepAgain()
Please look at the Github page for more details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With