@Override
  public void onResume() {
    super.onResume();

    if (!authorizeCalled_) {
      try {
        GDAndroid.getInstance()
            .authorize(
                new GDAppEventListener() {

                  private boolean uiLaunched_ = false;

                  @Override
                  public void onGDEvent(GDAppEvent event) {
                    if (event.getEventType() == GDAppEventType.GDAppEventAuthorized
                        && !uiLaunched_) {
                      startActivity(new Intent(LaunchActivity.this, MainActivity.class));
                      uiLaunched_ = true;
                    }
                  }
                });

        authorizeCalled_ = true;
      } catch (GDError gderror) {
        showErrorPopup(gderror.getMessage());
      }
    } else {
      finish();
    }
  }
 @Override
 protected void onResume() {
   super.onResume();
   if (isAppAuthorized_) {
     loadLastOpenedFile();
   }
   resumed_ = true;
 }