How to use plugins in Cordova? Cordova plugin background mode
I already installed with the command
cordova plugin add https://github.com/katzer/cordova-plugin-background-mode.git' porém ao tentar usar usando 'cordova.plugins.backgroundMode.enable()' e 'cordova.plugins.backgroundMode.onactivate = function() { ..algo.. };
Nothing happens.
var app = {
link : "http://images.terra.com/2015/05/20/corinthians.png",
sCLoad: document.getElementById("corinthians"),
ativo : false,
loop : null,
rodarApp : function () {
var self = this;
this.loop = setInterval(function(){
if (self.ativo)
self.sCLoad.src = self.link;
}, 1000);
},
ativarDesativar : function () {
this.ativo = this.ativo ? false : true;
}
};
document.addEventListener("deviceready", app.rodarApp, false);