Auto Logout or Expire the session after 5 minutes of user inactivity

Sometimes we need to log out the user or expire his session if he did not perform any interaction with the app for 5 minutes or even If he locks the screen from the lock button. This can be implemented very easily by maintaining a thread(Waiter) which will give alert once 5 minutes are over…