After you logout using ParseUser.logout, when the come back to login in the app still remembers the previous user and tries to login automatically.
I tried using the ParseFacebookUtils.getSession(), but it's deprecated I think. So, how do i Logout my user.
This is what i have tried so far:
ParseFacebookUtils.getSession().closeAndClearTokenInformation();
ParseUser.logOut();
Login Code:
ParseFacebookUtils.logInWithReadPermissionsInBackground(this, permissions, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (user == null) //Pressed Cancel Button
{
Log.d("FaceBookParse -> ", "OnCancel");
} else if (user.isNew()) //New User
{
progressBar.setVisibility(View.VISIBLE);
getUserInfo();
Log.d("FaceBookParse -> ", "OnNewUser");
} else //Old User
{
Log.d("FaceBookParse -> ", "OnOldUser");
}
}
});
OnClick:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(
new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
switch (position) {
case 0:
Toast.makeText(Dashboard.this,"Settings",Toast.LENGTH_SHORT).show();
break;
case 1:
viewPager.setCurrentItem(position - 1);
Drawer.closeDrawers();
break;
case 2:
viewPager.setCurrentItem(position - 1);
Drawer.closeDrawers();
break;
case 3:
viewPager.setCurrentItem(position - 1);
LoginManager.getInstance().logOut();
Drawer.closeDrawers();
startActivity(new Intent(Dashboard.this, LaunchPage.class));
break;
}
}
}
);
尝试此方法。将此方法放入注销按钮的onlick侦听器中。
LoginManager.getInstance().logOut();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.