There is an application with activation authorization and activation for client operations. Is it worth creating an activator launcher that will read SharedPreferences and open the necessary activations or is there another, correct way?
1 answer
Always start authorization onCreate() , in onCreate() read your settings, if authorization has already been passed just open the following activations and close it if not, leave it.
P.S. In general, SplashScreen activations are so often used, it’s just a logo screensaver with something like that. This screen hangs for a couple of seconds and opens the next one after itself. You can create such a screen in the onCreate() method to start something
Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { if (authorized) { Intent intent = new Intent(SplashScreen.this, ClientActivity.class); startActivity(intent); finish(); }else { Intent intent = new Intent(SplashScreen.this, LoginActivity.class); startActivity(intent); finish(); } } }, 2000);//Ставите сколько сек, 1000 = 1с. - A couple of days ago, I already implemented everything in a splash activation =) - tehwolfua Sept
|
sharedPreferencesin the context of the choice of activit? Write the last authorization id insharedPreferencesand check its presence. If the identifier is present - intent to run client activation, otherwise, do not start the authorization part further. ButsharedPreferencesmay not be the best solution for storing such data, since this repository is a regular file. It depends on what data you need to work with. Perhaps it is better to use other means. - UserName