Categories
android facebook

Android Facebook SDK3.0, session state OPENING

I am trying to use the Facebook SDK 3.0 to retrieve an access token on button press in my android app. I have a generic button in my Activity that is doing the following:

Button facebook = (Button)findViewById(R.id.facebookLoginButton);
facebook.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Session session = new Session(getApplicationContext());
Session.setActiveSession(session);
session.openForRead(new Session.OpenRequest(SignInActivity.this).setCallback(statusCallback));
}
});

And then the callback:

private class FacebookSessionStatusCallback implements Session.StatusCallback {
@Override
public void call(Session session, SessionState state, Exception exception) {
String s=session.getAccessToken();
}
}

Clicking the button prompts me for my permission to access my profile as expected, but this callback is only ever called once with SessionState as “OPENING”. The state doesn’t change after this.

What am I missing here? My end goal is really just to get an access token once, and I don’t really care about persisting the session or using it to log into my app.