facebook登录不给我任何共鸣,无论是真是假

时间:2013-07-29 09:42:09

标签: android facebook android-facebook

我想使用facebook sdk,我完全按照这里的描述制作 https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

现在我要登录,我使用了这段代码

Session.openActiveSession(this, true, new Session.StatusCallback() {

    @Override
    public void call(Session session, SessionState state,
            Exception exception) {
        // TODO Auto-generated method stub
        if (session.isOpened()) {

            // make request to the /me API
            Request.executeMeRequestAsync(session,
                    new Request.GraphUserCallback() {

                        @Override
                        public void onCompleted(GraphUser user,
                                Response response) {
                            if (user != null) {
                                Toast.makeText(
                                        EditCustomerProfile.this,
                                        user.getName(),
                                        Toast.LENGTH_LONG).show();
                                Log.e("facebook-",
                                        user.getName());
                            } else {
                                Toast.makeText(
                                        EditCustomerProfile.this,
                                        "NULLnnl",
                                        Toast.LENGTH_LONG).show();
                                Log.e("facebook", "null");
                            }
                        }
                    });
        }else{
            Log.e("session", "not open");
        }
    }
});

问题是没有log我的意思是没有if语句而没有else语句。

请帮助

修改

我添加的内容

else{
                    Log.e("session", "not open");
                }

要检查会话是否已打开,log会显示not open

1 个答案:

答案 0 :(得分:2)

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}