Where can I update a users last access timestamp?


#1

Hi All,

I am using Ionic 2 rc4.

I have a function that updates a users last access timestamp.

I need to execute this function each time the app is accessed. Is there somewhere I can do this call?

I thought about doing the call in the app.component.ts in the platform.ready().then(() => {...}, but I think this only gets invoked once when the app starts up, and won’t get invoked again unless the app is killed.


#2

You could use a mix of when the first app-component is rendered and platform.resume when the app is paused and brought back


#3
platform.ready().then((readySource) => {
  this.platform.pause.subscribe(() => {
    //App paused or closed
  });

  this.platform.resume.subscribe(() => {
    //App resumed or start
  });
});