在facebook sdk 3.0注销无法正常工作
我已经尝试了
1
Facebook mFb=new Facebook("xxxxxxxx");
mFb.logout(this);
2
if (Session.getActiveSession() != null)
{
Session.getActiveSession().closeAndClearTokenInformation();
}
Session.setActiveSession(null);
答案 0 :(得分:2)
希望这可以帮助你......
public void logoutFromFB()
mAsyncRunner.logout(this, new RequestListener() {
@Override
public void onComplete(String response, Object state) {
Log.d("Logout from FB", response);
if (Boolean.parseBoolean(response) == true) {
// User successfully Logged out
}
}
@Override
public void onIOException(IOException e, Object state) {
}
@Override
public void onFileNotFoundException(FileNotFoundException e,
Object state) {
}
@Override
public void onMalformedURLException(MalformedURLException e,
Object state) {
}
@Override
public void onFacebookError(FacebookError e, Object state) {
}
});
}
答案 1 :(得分:1)
你可以这样做
clearUserPrefs(); // user prefrs
session.closeAndClearTokenInformation();
并调用您的Facebook登录活动
更新:
您可以使用传统的Google帐户管理器服务退出
AccountManager manager = (AccountManager) getSystemService(ACCOUNT_SERVICE);
Account[] accountsList = manager.getAccountsByType(ACCOUNT_TYPE); // ACCOUNT_TYPE = com.facebook.auth.login
for(int i=0;i<accountsList.length;i++)
manager.removeAccount(accountsList[i], null, null);