EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep
264 stars 106 forks source link

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

Closed alvaro562003 closed 7 years ago

alvaro562003 commented 7 years ago

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

alvaro562003 commented 7 years ago

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

alvaro562003 commented 7 years ago

seems to be similar to https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin/issues/29

EddyVerbruggen commented 7 years ago

@alvaro562003 you're right, good catch