Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Logging Out

Kevin Gonzales
Kevin Gonzales
4,638 Points

Why do we not logout in the background?

We usually do network calls etc trough a subthread. Isn't logging out similar to a network call? If so shouldn't we log out in the background to keep the app responsive to user input and not slow down the main tread? Correct if I'm wrong please. Just confused lol

I'm guessing if the action of logging a user out is in the process of happening, you really don't want the user interacting with your application, as at some point they are going to get logged out.

Say that was to occur in the middle of a "update" process you could get a bunch of odd errors.

Kevin Gonzales
Kevin Gonzales
4,638 Points

Makes sense! I was just thinking what if it was an accident(and we have added a cancel button that stops the logout). But i guess it really depends on preference. I think the real reason I asked this question was because I wanted to know if logging out was something done over the internet with our backend like login in is, or if its something done entirely in the application itself.

1 Answer

To answer the question in the comment:

Usually Logging out will be the same kind of action as logging in, but instead of Validating the user, it would invalidate that user.

As for this being in the application or on the server, all depends on your implementation.. I would expect this to be done on your remote server 99% of the time (logging in and out)

Reason for this is provides a centralized point where you can validate users and monitor who are currently logged in,