简体   繁体   English

Facebook登录不适用于Facebook App

[英]Facebook login don't work with facebook app

I have a strange problem in my app I have implemented the libraries of facebook, and I log the user. 我的应用程序中遇到一个奇怪的问题,我已经实现了facebook的库,并登录了用户。 I created hash, I created the API key (from facebook) etc etc everything worked perfectly, only I moved the classes in another project, copying both the manifest that the layout, and I no longer log in, if you have installed the facebook app (works if it is installed) ... What could I have forgotten? 我创建了哈希,我创建了API密钥(来自facebook)等,一切工作正常,只有我将类移到了另一个项目中,同时复制了布局的清单,如果您已经安装了facebook应用,则不再登录(如果已安装,则可以使用)...我可能忘记了什么? Here is the code of the login 这是登录代码

 // start Facebook Login
    Session.openActiveSession(this, true, new Session.StatusCallback() {

      // callback when session changes state
      @Override
      public void call(Session session, SessionState state, Exception exception) {

        if (session.isOpened()) {

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

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {


              if (user != null) {
               String nickname = user.getName();
                String id = user.getId();
              // TextView welcome = (TextView) findViewById(R.id.textView1);
              //  welcome.setText("Hello " + user.getName() + "!");

              SharedPreferences prefs = getSharedPreferences("Preferenze", Context.MODE_PRIVATE);
              SharedPreferences.Editor editor = prefs.edit();

              if (nickname != null) {
                  editor.putString("utente", ""+nickname);
                 editor.commit();
              }
              String fotoProfilo =  "https://graph.facebook.com/" + id + "/picture";
              if (id != null){
                 editor.putString("path", ""+fotoProfilo);
                 editor.commit();

              }

            Intent LogIn= new Intent(getBaseContext(), MenuLoggato.class);
            LogIn.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            LogIn.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
            LogIn.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            startActivity(LogIn);
            finish();
              //fin qui ci arriva
              }
            }
          });
        } else {
            System.out.println("non è entrato");
        }

        System.out.println("Log in non riuscito");
      }
    });
  }

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

Sorry for my english 对不起我的英语不好

The problem is that i have a bad version of the open gl libraries. 问题是我的open gl库版本不好。 I have downloaded and istaller a new version, and it generated a differente hash code, and it work. 我已经下载并安装了一个新版本的Ittaller,它生成了一个hashe哈希码,并且可以正常工作。 Thaks to all 向所有人致敬

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM