Jim
Jim

Reputation: 19582

Is there an equivalent to http session for an android app?

Is there a way to define something like a "session" for an android app?
I have an application that launches multiple activities and the user the app going from activity to activity etc.
Of course may switch to another app, take a phone call, stop using the app because he is busy so the app is in the background etc.
Is there an easy and meaningful way to define something like a single session across all these different cases? So that we can tell when a new session starts and possibly store some data for each session?

Upvotes: 7

Views: 1128

Answers (1)

Morrison Chang
Morrison Chang

Reputation: 12121

Unfortunately its up to the developer to define what a 'session' is in Android. Since your activity can be backgrounded for a phone call for a minute and then return to foreground - is that part of the same session or two sessions? How about a gap of 20 minutes? You can store a timestamp but you are responsible for 'expiring' and implementing appropriate behavior.

Upvotes: 1

Related Questions