When we login through parse.com so at the time of logout, we need to clear the current user.
We need to simple use method logOut() of parse.
Below is the code
ParseUser.logOut();
ParseUser currentUser = ParseUser.getCurrentUser(); // Now this will be null
I do it at when we clear the SharedPreference and go to Splash screen like this
ParseUser.logOut();
SharedPreferences accessTokenSharedPref = getActivity().getApplicationContext().getSharedPreferences(SharedPreferenceManager.USER_INFO, 0); SharedPreferences.Editor accessTokenEditor = accessTokenSharedPref.edit(); accessTokenEditor.clear();
accessTokenEditor.commit();
Intent intent = new Intent(getActivity(), SplashScreenActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); getActivity().finish();
0 Comment(s)