title: android facebook sdk 3.0 login and get user info
body: <p>I'm developing an APP which using needs few facebook info to register my own website.</p>
  
  <p>At first I was using facebook SDK 1.5, everything is working well. Until facebook says they'll stop supporting old(v2.0 and below) SDK since June 2013.</p>
  
  <p>So I have to upgrade it to 3.0, and re-write my code.</p>
  
  <p>Here's what I have done so far after read about facebook's official tutorial :</p>
  
  <p>manifst.xml</p>
  
  <pre><code>&lt;!-- some stuff --&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fbAppId"/&gt;
  &lt;activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" /&gt;
  </code></pre>
  
  <p>strings.xml</p>
  
  <pre><code>&lt;!-- some stuff --&gt;
  &lt;string name="fbAppId"&gt;1234567890&lt;/string&gt; &lt;!-- You do know this ID is fake, right ? --&gt;
  </code></pre>
  
  <p>code</p>
  
  <pre><code>public class LoginFragment extends SherlockFragment
  {
    private UiLifecycleHelper uiHelper;
  
    private Session.StatusCallback callback=new Session.StatusCallback()
    {
      @Override
      public void call(final Session session, final SessionState state, final Exception exception)
      {
        onSessionStateChange(session, state, exception);
      }
    };
  
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
      View view=inflater.inflate(R.layout.login_fragment, container, false);
  
      LoginButton authButton=(LoginButton)view.findViewById(R.id.btnLogin);
      authButton.setFragment(this);
      authButton.setReadPermissions(Arrays.asList("basic_info", "user_status", "email"));
  
      return view;
    }
  
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
      super.onCreate(savedInstanceState);
      uiHelper=new UiLifecycleHelper(getActivity(), callback);
      uiHelper.onCreate(savedInstanceState);
    }
  
    @Override
    public void onResume()
    {
      super.onResume();
  
      // For scenarios where the main activity is launched and user
      // session is not null, the session state change notification
      // may not be triggered. Trigger it if it's open/closed.
      Session session=Session.getActiveSession();
      if(session!=null&amp;&amp;(session.isOpened()||session.isClosed()))
      {
        onSessionStateChange(session, session.getState(), null);
      }
  
      uiHelper.onResume();
    }
  
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data)
    {
      super.onActivityResult(requestCode, resultCode, data);
      uiHelper.onActivityResult(requestCode, resultCode, data);
    }
  
    @Override
    public void onPause()
    {
      super.onPause();
      uiHelper.onPause();
    }
  
    @Override
    public void onDestroy()
    {
      super.onDestroy();
      uiHelper.onDestroy();
    }
  
    @Override
    public void onSaveInstanceState(Bundle outState)
    {
      try
      {
        super.onSaveInstanceState(outState);
        setUserVisibleHint(true);
        uiHelper.onSaveInstanceState(outState);
      }
      catch(Exception e)
      {
        e.printStackTrace();
        Log.w(Constants.TAG, "Error on save instance state, "+e.toString());
      }
    }
  
    private void onSessionStateChange(Session session, SessionState state, Exception exception)
    {
      if(state.isOpened()) //I don't know why state is always not opened......?
      {
        Request request=Request.newMeRequest(session, new Request.GraphUserCallback()
        {
          @Override
          public void onCompleted(GraphUser user, Response response)
          {
            if(user!=null)
            {
              Log.i(Constants.TAG, "Logged in...");
              Log.d("user fname", user.getFirstName());
              Log.d("user lname", user.getLastName());
              Log.d("user username", user.getUsername());
              Log.d("user email", (String) response.getGraphObject().getProperty("email"));
            }
            else
            {
              Log.i(Constants.TAG, "Logged out...");
            }
  
          }
        });
  
        Request.executeBatchAsync(request);
      }
    }
  }
  </code></pre>
  
  <p>When I run my APP, I can see a facebook login button.</p>
  
  <p>Press it, a dialog will shows up to ask me to allow my APP to access facebook info, email...etc.</p>
  
  <p>And after I press Yes, there is nothing happen, nothing comes out even in LogCat...</p>
  
  <p>How do I know user are actually logged in facebook, and access their info ?</p>