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.
The server session timeout value is different than the one in client app.
The session id is same though for the both the client and the server.
The Client app is to have both offline and online mode of operation for which the session id is being stored on the device.
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.
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?