EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cordova-plugin-insomnia not working cordova 6.3.1 / android 5.1.1

alvaro562003 opened this issue · comments

Hi Eddy,
Hope you are fine.

I follow the instructions written there: https://www.npmjs.com/package/cordova-plugin-insomnia

  1. cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git
    2) cordova prepare

Then in index.js i wrote :

if (window.plugins.insomnia && window.plugins.insomnia.keepAwake) {
window.plugins.insomnia.keepAwake(onSuccess,onError);
} else {
alert("insomnia plugin missing");
}

onSuccess is correctly invoked and executed. So i assumed the installation is correct.

But the screen of my SamSung Galaxy XCover 3 running on Android 5.1.1 sleeps after few seconds. Cordova 6.3.1

Do you have an idea of what's wrong ?

Thanks

When i call awake juste after the device ready event, insomnia work well.
But when called after the photo gallery, insomnia does not work.
The photo gallery i use is imagepicker: https://github.com/wymsee/cordova-imagePicker

seems to be similar to #29

@alvaro562003 you're right, good catch