在注销时禁用Facebook SDK 4.0中的“共享”按钮

时间:2015-04-15 14:53:14

标签: android facebook facebook-graph-api share-button

我实现了样本你好facebook,我对某些方面感到困惑。

首先,当我在Android Studio的真实设备中测试应用时,已经启用(可能)已经登录的Facebook应用程序的更新后按钮

当我通过按我的应用程序的Facebook登录按钮正常登录时,会显示个人资料图片和名称。但是,当我注销“分享”按钮时,为什么仍然启用?

private void updateUI() {

    boolean enableButtons = AccessToken.getCurrentAccessToken() != null;

    postStatusUpdateButton.setEnabled(enableButtons || canPresentShareDialog);


    Profile profile = Profile.getCurrentProfile();
    if (enableButtons && profile != null) {
        profilePictureView.setProfileId(profile.getId());
        greeting.setText(getString(R.string.hello_user, profile.getLastName()));
    } else {

我要放在这里postStatusUpdateButton.setEnabled(false);

        profilePictureView.setProfileId(null);
        greeting.setText(null);
    }
}

1 个答案:

答案 0 :(得分:0)

“共享”按钮不需要用户登录(通过您的应用程序)即可共享。它将切换到Facebook应用程序或弹出webview。在任何一种情况下,他们都可以登录Facebook而无需通过您的应用程序登录。

这就是为什么它永远不会被禁用,即使没有访问令牌。