Struggling to get it to work in Android 4.4.2
ojsglobal opened this issue · comments
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
<gap:plugin name="nl.x-services.plugins.insomnia" />
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
?
Best,
Eddy