Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Application which requires user to login first

Tags:

android

I am developing an application which requires user to login before accessing any functionalities. Currently the login page is a standalone activity. I would like to ask which activity should I place as the MAIN of my application, the login activity or application activity (the first activity after login). In either way, there is a situation that I need to finish the current activity and start the other one (e.g. When application activity is the MAIN, when user didn't login before, I need to manually finish the application activity and start the login activity. I am not sure if it is a good approach because the first activity was started with nothing done). What is the best practice for login application like this?

P.S. I saw Skype will first show a Splash Screen before the login activity. The login state can be determined in the Splash Screen activity and start the subsequent one (login or application) accordingly. But I am not likely to take this if there is other good approach because an extra splash screen is needed.

like image 379
pinglamb Avatar asked Dec 27 '25 21:12

pinglamb


1 Answers

It doesn't really matter and depends on your application model. Using finish() on an Activity is quite acceptable.

I would say if you have a short time-out on the 'logged in' session, then you will likely need to use the login activity quite regularly and set it as the MAIN activity.

If the login credentials are to be cached for a long period of time (or indefinitely) then set the other activity as the MAIN one.

like image 186
Squonk Avatar answered Dec 30 '25 16:12

Squonk