private void uploadBulletin(Bulletin bulletin, File zippedFile) {
    determinateDialog = DeterminateProgressDialog.newInstance();
    try {
      determinateDialog.show(getSupportFragmentManager(), "dlg_sending");
    } catch (IllegalStateException e) {
      determinateDialog.dismissAllowingStateLoss();
      // just means user has left app - do nothing
    }

    UniversalId bulletinId = bulletin.getUniversalId();
    AsyncTask<Object, Integer, String> uploadTask =
        new UploadBulletinTask(getApplication(), this, bulletinId);
    MartusSecurity cryptoCopy = cloneSecurity(getSecurity());
    uploadTask.execute(
        bulletin.getUniversalId(),
        zippedFile,
        AppConfig.getInstance(getApplication())
            .getCurrentNetworkInterfaceGateway(getServerIp(), getServerPublicKey()),
        cryptoCopy);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    store = AppConfig.getInstance(getApplication()).getStore();

    hqKey = new HeadquartersKey(getDesktopPublicKey());

    SecureFileStorageManager secureFileStorageManager =
        ((MainApplication) getApplication()).getMountedSecureStorage();
    Cursor cursor =
        getApplication()
            .getContentResolver()
            .query(FormsProviderAPI.FormsColumns.CONTENT_URI, null, null, null, null);
    cursor.moveToFirst();
    int columnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.FORM_FILE_PATH);
    String formPath = cursor.getString(columnIndex);
    try {

      indeterminateDialog = IndeterminateProgressDialog.newInstance();
      indeterminateDialog.show(getSupportFragmentManager(), "dlg_zipping");

      String instancePath =
          getIntent().getExtras().getString(MartusUploadManager.BULLETIN_ISTANCE_FILE_PATH_TAG);
      SecureFormLoaderTask task =
          new SecureFormLoaderTask(secureFileStorageManager, instancePath, null, null);
      task.setFormLoaderListener(this);
      task.execute(formPath);

    } catch (Exception e) {
      Log.e(TAG, getString(R.string.error_message_could_not_create_record), e);
      indeterminateDialog.dismissAllowingStateLoss();
      finish();
      Toast.makeText(this, getString(R.string.loading_form), Toast.LENGTH_LONG).show();
    }
  }
 private MartusSecurity getSecurity() {
   return AppConfig.getInstance(getApplication()).getCrypto();
 }