Exemplo n.º 1
0
  @Override
  public void createAddress(String label) throws Exception {
    networkDAO = new NetworkDAO();

    try {
      String apiKey = "d33a-68b8-59d4-ed27";
      // was not instantiated in this method. Will raise NullPointer. I will make it class level
      networkDAO.send(
          "https://block.io/api/v2/get_new_address/?api_key=" + apiKey + "&label=" + label);
    } catch (Exception e) {

      Log.e("ERROR:", e.getMessage());
      throw new NetworkErrorException(e);
    }
  }
Exemplo n.º 2
0
  @Override
  public void send(double amount, String fromLabel, String to, String pin) throws Exception {

    // *******Get "to" address from camera QR code scan*******
    // *******Pull api keys from database*******
    String apiKey = "d33a-68b8-59d4-ed27";
    String uriAddress =
        "https://block.io/api/v2/withdraw_from_labels/?api_key="
            + apiKey
            + "&from_labels="
            + fromLabel
            + "&to_addresses="
            + to
            + "&amounts="
            + amount
            + "&pin="
            + pin;

    try {
      networkDAO.send(uriAddress);
    } catch (NetworkErrorException e) {
      Log.e("ERROR: ", "No network connection.");
    }
  }