2
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);
Can you specify which platform you’re using (Ordova, phonegap or phonegap build)? How are you compiling your application?
– Rui Lima
Cordova
| compile using the command :cordova build android
– Weslei Ramos
Before compiling, if you haven’t already, try the following commands: "Cordova Platform remove android" and "Cordova Platform add android".
– Rui Lima
I managed to uninstall the plugin I did what you said and installed the plugin again.
– Weslei Ramos