0
我試圖在成功註銷Facebook時添加回調方法,因爲onSuccess方法似乎只在登錄時纔會調用。我在此處的其他地方獲得了以下代碼塊:onCurrentAccessTokenChanged在從Facebook註銷期間多次調用
private AccessTokenTracker fbTracker;
...
fbTracker = new AccessTokenTracker() {
@Override
protected void onCurrentAccessTokenChanged(AccessToken accessToken, AccessToken accessToken2) {
if (accessToken2 == null) {
Log.d(TAG, "User Logged Out.");
mEditor.putBoolean(PREF_KEY_FACEBOOK_LOGIN, false);
mEditor.commit();
Log.d(TAG, "fbLoginButton success");
String msg = "Facebook successfully logged out";
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
customFbLoginButton.setVisibility(View.VISIBLE);
customFbLogoutButton.setVisibility(View.GONE);
}
}
};
而在logcat中我看到:
D/LoginActivity: User Logged Out.
D/LoginActivity: fbLoginButton success
D/LoginActivity: User Logged Out.
D/LoginActivity: fbLoginButton success
D/LoginActivity: User Logged Out.
D/LoginActivity: fbLoginButton success
D/LoginActivity: User Logged Out.
D/LoginActivity: fbLoginButton success
D/LoginActivity: User Logged Out.
D/LoginActivity: fbLoginButton success
D/LoginActivity: User Logged Out.
D/LoginActivity: fbLoginButton success
在這種情況下,我不認爲這是做任何傷害,但我想嘗試一下,如果我可以修復它。這種行爲是否可以避免?