Showing posts with label prevent sleep mode. Show all posts
Showing posts with label prevent sleep mode. Show all posts

Friday, April 22, 2016

Cordova/PhoneGap inhibit/prevent sleeping mode

If you need to prevent the sleeping mode here is a plugin that does this..

Install it:
cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git

or

phonegap plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git

than to use it this is the code; to prevent sleep mode use:

window.plugins.insomnia.keepAwake()

instead to re-allow the sleeping mode again use:


window.plugins.insomnia.allowSleepAgain()

Please refer here to full documentation.....

 Bye..