Closed ojsglobal closed 9 years ago
Hey
This seems to be the answer to my prayers, but I just can't get it to work!
I'm using the latest version of both your plugin and Phonegap Build, but it seems to fail where ever I call it from:
config.xls
index.js var app = {
initialize: function() { this.bindEvents(); },
bindEvents: function() { document.addEventListener('deviceready', this.stayAwake, false); },
stayAwake: function() { var worked = function() { $('#message').append('AWAKE'); } var failed = function() { $('#message').append('BROKE'); } window.plugins.insomnia.keepAwake(worked, failed); }
}
Just keep getting the broke message and the screen goes off.
Any ideas?
Hi, sorry I couldn't answer any quicker.
Your code is a bit broken up, but I think the problem is in this.stayAwake. Can you try making stayAwake a global function and not prefix it with this?
this.stayAwake
stayAwake
this
Best, Eddy
Hey
This seems to be the answer to my prayers, but I just can't get it to work!
I'm using the latest version of both your plugin and Phonegap Build, but it seems to fail where ever I call it from:
config.xls
index.js var app = {
bindEvents: function() { document.addEventListener('deviceready', this.stayAwake, false); },
}
Just keep getting the broke message and the screen goes off.
Any ideas?