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?

  • Why not just make an authorization activation point of entry? If the authorization was successful, then we create an intent to launch client activation. sharedPreferences is needed to save the application's project, I think it is not suitable for this task. - UserName
  • The application should work also in offline mode - tehwolfua
  • one
    So, and where does sharedPreferences in the context of the choice of activit? Write the last authorization id in sharedPreferences and check its presence. If the identifier is present - intent to run client activation, otherwise, do not start the authorization part further. But sharedPreferences may 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
  • one
    Perhaps the Android Keystore System will do. - UserName
  • I was going to record the fact of successful authorization in sharedPreferences and the next time I run the test activation, if the connection was not available and AuthState was set to 'true', the client activation would be loaded. - tehwolfua

1 answer 1

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