Android Open Source - BlockchainWidget Blockchain Request






From Project

Back to project page BlockchainWidget.

License

The source code is released under:

The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and nei...

If you think the Android project BlockchainWidget listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.rbonestell.bcwidget.utils;
/*from w ww .  j ava 2 s  .  c  om*/
import com.fasterxml.jackson.databind.ObjectMapper;

public class BlockchainRequest
{

  private static String blockchainURL = "https://blockchain.info/latestblock";
  
  public static BlockchainResponse getBlockchainInfo()
  {
    BlockchainResponse resp = null;
    try
    {
      String rawResponse = WSClient.sendRequest(blockchainURL, WSClient.RequestType.GET);
      ObjectMapper mapper = new ObjectMapper();
      resp = (BlockchainResponse)mapper.readValue(rawResponse, BlockchainResponse.class);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return resp;
  }
  
}




Java Source Code List

com.rbonestell.bcwidget.BlockchainWidget.java
com.rbonestell.bcwidget.SelectFrequencyActivity.java
com.rbonestell.bcwidget.utils.BlockchainRequest.java
com.rbonestell.bcwidget.utils.BlockchainResponse.java
com.rbonestell.bcwidget.utils.WSClient.java