Search code examples
javascriptandroidioscordovaionic-framework

How to use the events 'pause' and 'resume' in an Angular/Ionic project?


In an Angular/Ionic project, where would I use the following attributes to appropriately handle my needs?

document.addEventListener('pause', actiontobeperformed, false);
document.addEventListener('resume', actiontobeperformed , false);

My needs are:

I am building an app that is protected, meaning that you can only view the content when:

you enter the correct access code your session has not timed out But when you go to Home, then I want somehow to record that the session is over and that the user needs to authenticate when he comes back in the app.


Solution

  • The cordova pause event might be your answer.

    And resume when they return.