如何在android中集成Facebook 3.1新的sdk登录?

时间:2014-10-31 11:14:38

标签: android facebook facebook-graph-api

我正在通过以下链接整合facebook3.0在我的Android应用程序中:

https://developers.facebook.com/docs/android/getting-started

在我的设备中,facebook app已经安装。

这是按下登录按钮,点击下面的代码

Session.openActiveSession(MainActivity.this, true, new Session.StatusCallback() {
              @Override
              public void call(Session session, SessionState state, Exception exception) {

                Log.e("session","open session");

                if (session.isOpened()) {

                    strAccesstoken=session.getAccessToken();
                     List<String> permissions = session.getPermissions();

                     Log.e("current permissions",""+permissions);
                        if (!isSubsetOf(PERMISSIONS, permissions)) {

                            Session.NewPermissionsRequest newPermissionsRequest = new Session
                                    .NewPermissionsRequest(MainActivity.this, PERMISSIONS);
                        session.requestNewPublishPermissions(newPermissionsRequest);
                            return;
                        }
                  // make request to the /me API
                     Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
                    @Override
                    public void onCompleted(GraphUser user, Response response) {

                        if (user != null) {
                            welcome = (TextView) findViewById(R.id.welcome);
                            welcome.setText("Hello " + user.getName() + "!");
                            strCurrentuser=user.getId();
                            Log.e("current user is","current user is"+strCurrentuser);

                          }

                    }
                  });
                }
              }
            });

当我运行我的应用程序时,它始终显示此对话框

enter image description here

我正在生成keyhash并将其保存在facebook开发者网站上。为什么我得到了这个对话框,我做错了。请帮助我任何人。谢谢所有人提前

0 个答案:

没有答案