Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49086

How to call rest api in background mode in ionic 4+

$
0
0

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

Read full topic


Viewing all articles
Browse latest Browse all 49086

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>