title: Android Application will not connect to server
body: <p>My android application used to be able to connect to the Facebook server via the API, but now it won't for some reason. I keep on getting this message in my log cat</p>
  
  <p>D/Facebook-authorize(417): Login failed: com.facebook.android.DialogError: The connection to the server was unsuccessful.</p>
  
  <p>Ive read many stack overflow questions regarding this, without answer. I am hoping someone can help me with this. Thank you!</p>
  
  <p>Here is some of my code with my App ID edited out </p>
  
  <pre><code>public class BreadcrumbsActivity extends Activity {
  
  static Facebook facebook = new Facebook("*************");
  String FILENAME = "AndroidSSO_data";
  static SharedPreferences mPrefs;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      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[] {"user_likes", "user_photos", "email", "offline_access", "publish_actions"}, new DialogListener() {
              @Override
              public void onComplete(Bundle values) {
                  SharedPreferences.Editor editor = mPrefs.edit();
                  editor.putString("access_token", facebook.getAccessToken());
                  editor.putLong("access_expires", facebook.getAccessExpires());
                  editor.commit();
  
                  Toast.makeText(getApplicationContext(),
                          "Login Succesful.",
                          Toast.LENGTH_LONG).show();
  
                  Intent intent = new Intent(BreadcrumbsActivity.this, MainMenu.class);                   
                  BreadcrumbsActivity.this.startActivity(intent);
              }
  
              @Override
              public void onFacebookError(FacebookError error) {
                  Toast.makeText(getApplicationContext(),
                          "Login Failed.",
                          Toast.LENGTH_LONG).show();
  
                  Intent intent = new Intent(BreadcrumbsActivity.this, MainMenu.class);                   
                  BreadcrumbsActivity.this.startActivity(intent);
              }
  
              @Override
              public void onError(DialogError e) {}
  
              @Override
              public void onCancel() {}
          });
      }
  }
  
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      facebook.authorizeCallback(requestCode, resultCode, data);
  }
  </code></pre>
  
  <p>}</p>