我在我的代码中添加了Facebook登录按钮 . 它运作良好 .
假设用户通过facebook登录并取消选中'user_friends'权限:将调用'onSuccess'函数,以便可以从loginResult中获取用户数据 .
下次当他打开应用程序时,他将获得facebook权限屏幕以允许'user_friends'权限 . 假设他再次取消选中它:'onCancel'函数将被调用,尽管用户现在将按预期自动登录(因为他从未注销) .
How can I get his data now in onCancel? (because I know that he is logged in but unchecked some permission)
The User logged in last time and not this time so onSuccess won't be called this time
mCallbackManager = CallbackManager.Factory.create();
mLoginButtonFacebook.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
}
@Override
public void onCancel() {
AccessToken token = AccessToken.getCurrentAccessToken();
if (token != null) {
// here I would like to retrieve the user data
// the user is logged in with canceled permissions
}
}
@Override
public void onError(FacebookException exception) {
}
});
1 回答
Succeeded! sorry for your time and thanks.