title: Android facebook sdk 3.0.1 using last session
body: <p>I have the following scenario with facebook sdk 3.0.1. When user first login and chooses "FB login" then the SSO starts, a new session is open and everything works fine. But then, when the user closes the app and start it again - I don't understand how to get the last open session, currently I'm opening a new session and the user sees again the FB progress bar(while it's being connected to FB again, even so the user already approved FB in his last run). Does anybody know how to skip this operation?</p>
  
  <p>Edit 1:</p>
  
  <p>This is how I retrieve the session:</p>
  
  <pre><code>public void tryRetrievFacebookSession() {
      Session session = Session.getActiveSession();
  
      if (session != null &amp;&amp; session.isOpened())
          return;
  
      session = Session.openActiveSession(this, true, new Session.StatusCallback() {
  
          @Override
          public void call(Session session, SessionState state, Exception exception) {
              MobliLog.d("SplashScreen", "Inside call() with session with state: " + session.getState());
              // onSessionStateChanged(session, state, exception);
          }
      });
  
  }
  
   @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      Session session = Session.getActiveSession();
  
      if (session != null)
          session.onActivityResult(this, requestCode, resultCode, data);
  
      uiHelper.onActivityResult(requestCode, resultCode, data);
  
  }
  </code></pre>
  
  <p>The session is normally being created or from the LoginButton or with those lines:</p>
  
  <pre><code>session = Session.getActiveSession();
  
      if (session.getState().isClosed())
          session = new Session(this);
  
      if (session.isOpened()) {
          onAuthenticationEndListener.onSuccessfullAuthentication();
          return;
      } else {
          this.onFacebookAuthenticationEndListener = onAuthenticationEndListener;
          Session.setActiveSession(session);
          session.openForRead(new Session.OpenRequest(SocNetwksCompatScreen.this).setCallback(null));
          return;
      }
  </code></pre>
  
  <p>Information 1:</p>
  
  <p>When I'm doing the first Session session = Session.getActiveSession(); in the logins after the sso authentication, my session has state CLOSED instead of OPENED</p>
  
  <p>Information 2:
  I'm using uiHelper and initialize it like this:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      twitter = SocialPluginsUtils.getTwitterClient();
  
      uiHelper = new UiLifecycleHelper(this, statusCallback); 
      uiHelper.onCreate(savedInstanceState);
  }
  </code></pre>
  
  <p>Now, I know that after I perform Session.getActiveSession(); the session state should get OPENED and after that OPEN and then the uiHelper's callback should be invoked. In my code the state is CLOSED or CLOSED_LOGIN_FAILED or CREATED(not sure why it's not stable)  and the rest doesn't happens</p>