There are probably a few other ways to do this. If the user goes away from
your app, and android doesn't shut it down, then comes back, the user should
still be logged in right? As Mark said, onResume() is where you can figure
this out.

Another way is to use SQLite or something to store a session token and in
onResume look it up and check the timestamp of when it was stored (you'd put
that in your onPause..storing it with timestamp). Then, if the timestamp is
< some amount of time, continue with it.. if not, invalidate and take to
login screen. Any form of storage could be used for this.. since a phone is
a single user device, you could store a file like a lock file, etc.


On Thu, Feb 10, 2011 at 1:56 PM, Mark Murphy <[email protected]>wrote:

> On Thu, Feb 10, 2011 at 4:53 PM, Hari <[email protected]> wrote:
> > There are 2 possibilities,
> > 1. you come back to the same screen (activity) due to the application
> > flow. Navigate to other activities and come back to it due to
> > application functionality.
> > 2. you come back after you navigate away to another application.
> >
> > Is there a way to recognize this using the application attributes or
> > context attributes.
>
> Your app should not care one way or another. The user is logged in, or
> the user is not logged in. It does not matter whether the previous
> activity was one of yours or not one of yours.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to