How to call rest api in background mode in ionic 4+
platform.ready().then(async () => {
console.log(“background mode offff”)
this.backgroundMode.enable();
console.log(“background mode check”,this.backgroundMode.isActive(), this.backgroundMode.isEnabled(),this.backgroundMode.isScreenOff);
// this.backgroundMode.enable();
console.log("-------------------->", this.backgroundMode.isEnabled());
console.log("-------------------->", this.backgroundMode.isActive());
this.backgroundMode.on("activate").subscribe(async ()=>{
// alert("background mode activated")
this.getLastestOrders()
console.log("background mode on");
setInterval(()=>{
console.log("calling in 2 sec")
}, 2000);
});
});
Description:-
only shows on ‘background mode on’ … setInterval is not working, and this.getLastestOrders() is also not calling here
what wrong in my code ??
2 posts - 2 participants