[英]is there callback methods for logout facebook button in android?
I want to perform some task when user clicked logout button and at the time if the user is logged out perform some task(say to open another activity) 我想在用户单击注销按钮时执行一些任务,并且在用户注销时执行一些任务(例如打开另一个活动)
CallbackManager mCallbackManager = CallbackManager.Factory.create();
FacebookCallback<LoginResult> mCallback = new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
// AccessToken accessToken = loginResult.getAccessToken();
// Boolean value = accessToken.isExpired();
Profile profile = Profile.getCurrentProfile();
if (profile != null) {
String userId = profile.getId();
String userName = profile.getName();
Log.d("userId", userId);
Log.d(TAG, "name : " + userName);
// sessionManager.createLoginSessionViaApp(userId, userName);
// disableTheAppSignInRegisterButtonsIfLoggedin();
}
}
@Override
public void onCancel() {
Log.d(TAG, "status cancel");
}
@Override
public void onError(FacebookException e) {
Log.d(TAG, "status error login");
}
};
fbLoginButton.setReadPermissions("user_friends");
fbLoginButton.registerCallback(mCallbackManager, mCallback);
I've done this so far for login 到目前为止,我已经完成了登录
You can use the AccessTokenTracker to track logouts. 您可以使用AccessTokenTracker来跟踪注销。 It will call onCurrentAccessTokenChanged, and the currentAccessToken will be null if the user has logged out.
它将调用onCurrentAccessTokenChanged,如果用户已注销,则currentAccessToken将为null。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.