Search code examples
androidfacebookxauth

Process for XAuth login through Facebook


I have a valid API key from facebook and I tried using this line of code:

facebookClient = new Facebook("my APP ID");
facebookClient.authorize(this, this)

from Facebook login through android

I also overriden DialogListener in this class

@Override
public void onComplete(Bundle values) {
    System.out.println("TEST completed "+values);
}

@Override
public void onFacebookError(FacebookError e) {
    System.out.println("TEST error: "+e.getMessage());
}

@Override
public void onError(DialogError e) {
    System.out.println("TEST error: "+e.getMessage());
}

@Override
public void onCancel() {
    System.out.println("TEST cancelled!");
}

But logcat does not print any message from the implemented methods.

Is there something that I have missed?


Solution

  • No one is answering and I just found my fix.

    For my solution, I had to make sure that I was logged in facebook.

    if (Session.getActiveSession() != null) {
      //implement dialog listener
    } else {
      //do facebook login here
    }