title: How can I initiate user logout after 5 minutes of inactivity?
body: <p>I am trying to log out and invalidate the user token after 5 minutes of inactivity.</p>
  
  <p>When the application is on 'active' stage I am using the react-native-user-inactivity and set the timeForInactivity for 5 minutes. However, when the application runs on the background it has an expected behavior, especially when I set it to 5 minutes. </p>
  
  <p>I was using 1 minute for testing and it was running fine, it used to call the API and invalidates the token correctly after the minute has passed. However, when I have increased it to 5 minutes, it was not firing until the application stage changed to 'active'.</p>
  
  <p>I have similar behavior when I use the setTimeout for 5 minutes on AppState change event. </p>
  
  <p>I have only tried it iOS but I have read somewhere that on Android it is giving an error when setting a timeout for more than 2 minutes. Is that correct?</p>
  
  <p>What is the best way to invalidate the user token:
  1. When the application is in the background
  2. Just before closing the application?</p>