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..

1 comment:

  1.  I appreciate your efforts of writing this blog content, it’s really a beneficial and informative post. Good work!! Keep going on.
    PhoneGap Development Company Texas

    Hire PhoneGap Developers

    ReplyDelete