I see there's a new version of Facebook SDK (3.0) that deprecates the old Facebook class and introduces a new way of logging in using the Session class.
I quickly wrote a simple app using the new login API:
public class MainActivity extends Activity {
private Session mFacebookSession;
private StatusCallback fbStatusCallback = new StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
Log.v("dbg", "state: " + state);
Log.v("dbg", "session: " + session);
}
};
public void bc(View view)
{
mFacebookSession = Session.openActiveSession(this, true, fbStatusCallback);
}
//etc..
}
The callback should get called twice, first for destroying the actual session token and second for getting a new access token. Of course, my app id is set as a meta-data in my manifest file, etc.
When I execute the code, the Facebook Login dialog appears, I input my username and password and then it closes.
However, in my log I only see this:
01-17 03:28:01.587: V/dbg(7002): state: OPENING
01-17 03:28:01.587: V/dbg(7002): session: {Session state:OPENING, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:xxxxxxxxxxxxxxx}
As a result, if I try to call mFacebookSession.getAccessToken() i get an empty string (not null).
What seems to be the problem?
HOW I SOLVED THIS (LATER)
I have overridden onActivityResult and called Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);