title: How to use fb connect in Android app?
body: <pre><code>public class FacebookConnect extends Activity {
  
      Facebook facebook = new Facebook("");
      String FILENAME = "AndroidSSO_data";
      private SharedPreferences mPrefs;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          /*
           * Get existing access_token if any
           */
          mPrefs = getPreferences(MODE_PRIVATE);
          String access_token = mPrefs.getString("access_token", null);
          long expires = mPrefs.getLong("access_expires", 0);
          if(access_token != null) {
              facebook.setAccessToken(access_token);
          }
          if(expires != 0) {
              facebook.setAccessExpires(expires);
          }
  
          /*
           * Only call authorize if the access_token has expired.
           */
          if(!facebook.isSessionValid()) {
  
              facebook.authorize(this, new String[] {}, new DialogListener() {
                  public void onComplete(Bundle values) {
                      SharedPreferences.Editor editor = mPrefs.edit();
                      editor.putString("access_token", facebook.getAccessToken());
                      editor.putLong("access_expires", facebook.getAccessExpires());
                      editor.commit();
                  }
  
                  public void onFacebookError(FacebookError error) {}
  
                  public void onError(DialogError e) {}
  
                  public void onCancel() {}
              });
          }
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          facebook.authorizeCallback(requestCode, resultCode, data);
          AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(this.facebook);
          asyncRunner.request("me", new meRequestListener());
      }
  }
  </code></pre>
  
  <p>That is my code to connect with FB to log in. I've two doubts with it:
  1. How do I get the user info? (FB name)
  2. How do I store it in the database. The problem here is that even if I allow an user to log in via facebook, there can be other users with the same name. So, does fb allow me to get their e-mail address for creating an unique entry in the database?</p>