Is there any complete sample about cordova plugin background mode?
I am get error 'backgroundMode' of undefined
Is there any complete sample about cordova plugin background mode?
I am get error 'backgroundMode' of undefined
I too had the same issue. Just got it solved.
I would advise you not to follow the Ionic Documentation.
Use the following code in CLI to install the plugin.
cordova plugin add https://github.com/katzer/cordova-plugin-background-mode.git
Then in your ionViewDidLoad()
of the root of your app, you can write the following code:
ionViewDidLoad(){
cordova.plugins.backgroundMode.enable();//Line 1
console.log("BackgroundMode is Enabled!");//Line 2
console.log(cordova.plugins.backgroundMode);//Line 3
}
Before this, you should declare cordova
by following code after all your imports.
declare let cordova:any;
This one should help :)