Skip to content

Plugin doesn't work in iOS #25

@Kaushik0704

Description

@Kaushik0704

@Viras- I want Screen always wake-up in iOS, so I'm integrating power management Cordova plugin for iOS.

After Create cordova project for iOS, I added this plugin.
(cordova plugin add https://github.com/Viras-/cordova-plugin-powermanagement.git)

and put this code in my script but plugin code is not works for me.

Here is my code:

<script type="text/javascript"> 

document.addEventListener("deviceready", onDeviceReady, false);

//function will be called when device ready
function onDeviceReady()
 {

     var isDeviceiOS = /iPad|iPhone|iPod/.test(navigator.userAgent); 
     if(isDeviceiOS) 
     { 
          if(window.localStorage.getItem('keepscreenonchkboxlocal') == "true")
          {
                isIdleTimerDisabled = true;
          }
          else
          {
                isIdleTimerDisabled = false;
          }
     }
     else
     {         
          if(window.localStorage.getItem('keepscreenonchkboxlocal') == "true")
          {
               window.powerManagement.acquire(function() { 
                   console.log('Wakelock acquired');            
                         }, function() { 
                   console.log('Failed to acquire wakelock');               
               });
          }
          else
          {
               window.powerManagement.release(function() {      
                   console.log('Wakelock released');        
                       }, function() {   
                   console.log('Failed to release wakelock');           
               });
          }
      }
}
</script> 

This cordova plugin works in android but doesn't works in ios.

Thanks, Kaushik.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions