androidsessionsession-timeout

how to maintain an offline session management strategy in android


We need to implement an offline session management strategy in android.

The requirement is for the user session to be timed out after a specified timeout value on the client app if the device is idle.

As per the requirements above what would be the best strategy to handle the scenario when the server timeouts before the client app while the device is in offline mode and then comebacks again to a networked state, by the time in which the session in the server would have timed out.


Solution

  • In regards to having a time out on the client app I believe you can run a service that will basically keep track of how long the app has been idle and when a condition is met it will trigger an action for you.

    You can use java timers and when the app is responsive again, you reset the timer and start it again when the app is in the background perhaps?