You can save the authorization status, in the simplest case, in the form of a flag in SharedPreferences .
After authorization, save the status:
SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean("IS_AUTHORIZED", true); editor.commit();
After logging out:
SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean("IS_AUTHORIZED", false); editor.commit();
When you start the activation you get the status:
SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE); boolean isAuthodized = sharedPreferences.getBoolean("IS_AUTHORIZED", false);
If isAuthodized == true , then open the necessary activation.
Also, activation with authorization is advisable to specify the android:noHistory="true" attribute android:noHistory="true" .