1) This is not the best option, at least not without option 2, as the user can still leave without having the opportunity to log out, for example to answer a call.
2) I do this, it's a bit of a pain as I need to check the timeout in every activity, and I have at least a couple of dozens. So it's a bit of a maintanence issue. I set my timeout to, I think, 10 seconds. Long enough, so if the user accidentally presses the home button, they can get back in quickly. On Jul 17, 3:40 am, Streets Of Boston <[email protected]> wrote: > You have no control over the application and/or activity life cycle. > This will make is very hard to determine when the user 'exits' the > app. > > I would do this: > 1. Consider an explicit 'log-out' option for your users. > 2. Add a time-out to your login-sessions. Refresh the session (time- > out) when the user interacts with your app/server. But when the user > hasn't interacted with your app/server for a given amount of time, the > user's session will have had a time-out and this then would require > the user to login again. > > On Jul 16, 4:09 am, "Kim D." <[email protected]> wrote: > > > > > Hello, > > > I have an application which requires a login at the beginning (this is > > the first activity). When the user logs in, I keep his credentials in > > the application (I extended android.application to add a field called > > 'key'). I would like to clear this field from memory (from application > > instance) an go back to the login activity. > > > I see the following possibilities: > > - Add a broadcast receiver to catch all possible event (call, click on > > menu, click on back, lock the phone ...) which clear the key field and > > launch the login activity > > - Use clearTaskOnLaunch for all activities except the login activity. > > But then until my application takes the focus again the key stays in > > the application object. (It seems it doesn't work with the go back > > button, maybe I need to use no history also) > > - Detect for each activity in all onPause or onStop events when > > application will leave the foreground > > to clear the key field and launch the login activity > > > The best would be to have a kind of OnPause method at application > > level but I think it doesn't exist > > > I would appreciate any help on this problem. > > > ps: I already posted it once but never saw it on the discussions list. > > > Cheers, > > Kim- Hide quoted text - > > - Show quoted text - -- 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

