I see there a new version of the Facebook SDK (3.0), which depreciates the old Facebook class and introduces a new way to log in using the Session class.
I quickly wrote a simple application 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); }
The callback must be called twice, first to destroy the actual session token, and the second to obtain a new access token. Of course, my application id is set as metadata in my manifest file, etc.
When I run the code, the Facebook login dialog appears, I enter my username and password, and then it closes.
However, in my journal I see only 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 (but not null).
What is the problem?
HOW I SOLVED THIS (LATER)
I overridden onActivityResult and called Session.getActiveSession (). onActivityResult (this, requestCode, resultCode, data);