I am using the ionic Background Mode plugin. First, I installed in the project, imported in the app.module.ts file and put this code in app.component.ts file this.backgroundMode.enable();
. I want to check if background mode is active in the background run function. I want to run my function when the background mode is active.
let inBackground = true;
this.backgroundMode.isActive();
this.myfunction();
Does anyone know how to do this??
Better to do it as in example below:
this.backgroundMode.on('activate').subscribe(s => {
console.log('backgroundMode activate');
});
this.backgroundMode.enable();
More information about it you can take from this Cordova Background Plugin