0

I tried use facebook credentials to log my application. i used This to develop that login. when i log using my fb account it display the my fb username. but when login using another account it display error.

This is my activity code,

@Override
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        //authButton = (Button) findViewById(R.id.authButton);
        // start Facebook Login
        Session.openActiveSession(this, true, new Session.StatusCallback() {

          // callback when session changes state
        @SuppressWarnings("deprecation")
        @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) {
                    TextView welcome = (TextView) findViewById(R.id.welcome);
                   // welcome.setText("Hello " + user.getName() + "!");

                    welcome.setText(user.getName() + ","
                            + user.getUsername() + ","
                            + user.getId() + "," + user.getLink()
                            + "," + user.getFirstName()+ user.asMap().get("email"));
                  }
                }
              });
            }else{

                Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();

            }
          }

        });
      }

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

I want to display fb name when log in diffrent accounts.

anuruddhika
  • 1,549
  • 8
  • 26
  • 40

2 Answers2

1

Do you have to get a different key? Maybe the hash is a debug key or something? Diable sandbox mode? Click here How to log in with other facebook account? ?

Community
  • 1
  • 1
a person
  • 986
  • 6
  • 13
1

Go to Facebook developers page

Apps --> "YourApp" --> Status and Review --> Enable ("Do you want to make this app and all its live features available to the general public?")

Juvi
  • 1,078
  • 1
  • 19
  • 38