Avoid Sleep Mode (Cordova Power Management Plugin)

3 posts, 0 answers
  1. NOON
    NOON avatar
    5 posts
    Member since:
    Aug 2009

    Posted 10 Oct 2014 Link to this post

    I am currently trying to turn off sleep mode while an update is in progress. In order to accomplish this i am trying to use power management plugin with my telerik appbuilder windows client.  I import the plugin in my app but it does not show up in other plugins section. Am i missing something? Is there another way to turn sleep mode on/off in all devices?
  2. Craig
    Craig avatar
    43 posts
    Member since:
    Aug 2013

    Posted 14 Oct 2014 in reply to NOON Link to this post

    Since no support answered you I hope this helps... I installed one plugin manually  (not using Plugin Marketplace) and for my plugin it did show up in Other Plugins - see attached image.  Only difference was the missing ON/OFF button which makes sense.
  3. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 14 Oct 2014 Link to this post

    Hello guys,

    The Other Plugins section in AppBuilder displays only the Telerik verified plugins and as the PowerManagement plugin is not one of them, it will not be displayed in the project properties. However, this does not mean that you cannot work with it. On the contrary, as long as you can see it successfully imported under the Plugins folder in your project, you can go ahead and utilize its functionality.

    The plugin allows you to invoke the following methods:
    • powerManagement.acquire(onSuccess, onError,runLockScreen); -  acquire a new wake-lock to keep device awake
    • powerManagement.release(onSuccess, onError); - release the wake-lock
    • powerManagement.dim(onSuccess, onError); - acquire a partial wake-lock, allowing the device to dim the screen

    If you need any further information on how these methods work on each device, you can follow the links provided by the plugin author in its repository:

    I attached a sample project where the plugin is imported and the powerManagement.acquire() method is invoked as soon as the deviceready event fires. I tested the app on an iPhone 5C running iOS7.0.4 and it works as expected on my side. 

    Tina Stancheva

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Back to Top