0

在 facebook sdk 3.0 中注销不起作用

我已经试过了

1.

Facebook mFb=new Facebook("xxxxxxxx");
mFb.logout(this);

2.

if (Session.getActiveSession() != null) 
 {
  Session.getActiveSession().closeAndClearTokenInformation();
 }
Session.setActiveSession(null);
4

2 回答 2

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) {
    }
});
}
于 2013-06-27T04:51:21.577 回答
1

你可以这样做

clearUserPrefs(); // user prefrs

session.closeAndClearTokenInformation();

并调用您的 Facebook 登录活动

更新:

您可以使用传统的谷歌帐户管理服务注销

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);
于 2013-06-27T04:37:52.257 回答