Is there a trigger to tell when app is re-entered?

Our app (like i would guess most) gets its data from a website. We have a routine to ask the site if it has new data; and if yes we asynchronously fetch new data from site to store in local storage.

My question is simple. What should trigger this?

My data is loaded fine the first time the app runs; but subsequent times (for multitasking devices); the device is already ready and as far as i can tell nothing gets triggered. My app just picks up and the same place it was when i left to run some other app.

One idea i have is to simply do a “timer” based off how many tabs are opened (since i dont want to do this network action on every tab). I can trigger an update check every 10 or 20 tab clicks. Not best; but at least this way i know data will eventually be updated.

You can call it on resume of the app. This gets called every time they minimize the app and open it again:

$ionicPlatform.on('resume', function(){
    // Call function to get data

I put this in the app run function. Does this accomplish what you need?


Yes, i think that is it.


1 Like

Is it possible to simulate a “resume” with Chrome emulator?

why not install genymotion and test

taking a look now; although $500 to work around .resume() seems a bit steep; but perhaps the free version does this.

the free version is awesome been using it a couple months now and it is really fast