title: if(session.isOpen()), facebook login on android always returning false
body: <p>I'm trying to implement a simple activity in my android application where a user is asked to login via facebook so that the user's 'likes' are retrieved. So obviously first I'm testing a simple login via facebook. I'm using the exact code they have on 'Getting Started with the Facebook SDK for Android' - Step 6 (<a href="https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/">https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/</a>) but for some reason it's not working. When I debugged the code I realised that the following condition: </p>
  
  <pre><code>if(session.isOpen()) 
  </code></pre>
  
  <p>is <strong>ALWAYS</strong> returning false even though I'd already be logged onto facebook. I've tried everything to fix it but nothing seems to be working.</p>
  
  <p>Anybody had this issue or knows how to fix it?</p>
  
  <p><strong>EDIT:</strong> I'm trying this test on my phone directly not on an emulator. I don't know if that could be an issue.</p>
  
  <p>Thanks in advance!</p>
  
  <p>And I did try this solution <a href="http://facebook.stackoverflow.com/questions/15490730/session-isopened-returns-false-even-if-successfully-logged-in-to-facebook">session.isOpened() returns false even if successfully logged in to Facebook</a> but using java 6 or 7 still gave the same hash key.</p>
  
  <p><strong>EDIT 2:</strong> I've also tried the same thing but with a slightly different approach. <a href="http://sonyarouje.com/2011/09/18/facebook-hash-key-for-android-apps/">http://sonyarouje.com/2011/09/18/facebook-hash-key-for-android-apps/</a> I'm still having the same problem. The <i>session.isOpen()</i> method is always returning false.</p>
  
  <p><strong>EDIT 3:</strong> Here is the latest code I've tried. I don't think there are any errors in the logcat. Anyway I'll link it here just in case I'm missing something.</p>
  
  <pre><code>package com.example.danandroidapp;
  import java.util.Arrays;
  
  import com.facebook.FacebookException;
  import com.facebook.Request;
  import com.facebook.Response;
  import com.facebook.Session;
  import com.facebook.SessionState;
  import com.facebook.model.GraphUser;
  import com.facebook.widget.LoginButton;
  import com.facebook.widget.LoginButton.OnErrorListener;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.util.Log;
  import android.view.Menu;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
      private String TAG = "MainActivity";
      private TextView lblEmail;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          lblEmail = (TextView) findViewById(R.id.lblEmail);
  
          LoginButton authButton = (LoginButton) findViewById(R.id.authButton);
  
          authButton.setOnErrorListener(new OnErrorListener() {
              @Override
              public void onError(FacebookException error) {
                  Log.i(TAG, "Error " + error.getMessage());
              }
          });
  
          authButton.setReadPermissions(Arrays.asList("basic_info", "email"));
          authButton.setSessionStatusCallback(new Session.StatusCallback() {
  
          @Override
          public void call(Session session, SessionState state, Exception exception) {
              if(session.isOpened()) {
                  Log.i(TAG, "Access Token " + session.getAccessToken());
                  Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
  
                      @Override
                      public void onCompleted(GraphUser user, Response response) {
                          if(user != null) {
                              Log.i(TAG, "User ID " + user.getId());
                              Log.i(TAG, "Email " + user.asMap().get("email"));
                              lblEmail.setText(user.asMap().get("email").toString());
                          }
                      }
                  });
              }
          }
      });
  }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>And my logcat output: <a href="https://www.dropbox.com/s/7qg9zbhlpikfovf/log.txt">https://www.dropbox.com/s/7qg9zbhlpikfovf/log.txt</a></p>