Exemplo n.º 1
0
  @Override
  protected JSONObject doInBackground(String... params) {
    String jsonString = params[0];

    // get url
    int localCatalogIndex = PrefUtils.getLocalCatalogIndex(activity);
    String paiaUrl =
        Constants.getPaiaUrl(localCatalogIndex)
            + "/core/"
            + PaiaHelper.getInstance().getUsername()
            + "/request?access_token="
            + PaiaHelper.getInstance().getAccessToken();

    JSONObject paiaResponse = new JSONObject();

    try {
      this.setPostParameters(jsonString);
      paiaResponse = this.performRequest(paiaUrl);
    } catch (Exception e) {
      e.printStackTrace();

      this.raiseFailure();
    }

    return paiaResponse;
  }
Exemplo n.º 2
0
  private void cleanStoredCredentials() {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());
    SharedPreferences.Editor editor = sharedPref.edit();

    editor.putString("store_login_username", null);
    editor.putString("store_login_password", null);

    editor.commit();

    // and remove stored login information
    PaiaHelper.getInstance().reset();

    BaseActivity instance = BaseActivity.instance;
    if (instance != null) {
      instance.selectSearch();
    }
  }