Android: retrieving binary ("blobpayload") data

Jul 16, 2012 at 5:13 PM
Edited Jul 17, 2012 at 5:58 PM

This post duplicates information in an earlier topic and has duly been appended to this discussion (http://healthvaultjavalib.codeplex.com/discussions/265474)

(To the moderator: this post is now classic "user answered their own question" so please treat accordingly, sorry)

Summary

to get this working on android; just add a few lines to the code for the "Weighter" sample app as indicated below:

@SuppressWarnings("unchecked")
public static String getRawXml_n_BinaryData(Record record, String HV_TYPE) {
    SimpleRequestTemplate template = new SimpleRequestTemplate(
	HealthVaultService.getInstance().getConnection(),
        record.getPersonId(),
        record.getId());

    String info = "<info>" +
    "<group max=\"25\">" +
        "<filter>" + 
            "<type-id>" + HV_TYPE + "</type-id>" + 
        "</filter><format>" + 
            "<section>core</section>" +
            "<section>blobpayload</section>" +
            "<xml/>" + 
            "<type-version-format>" + HV_TYPE + "</type-version-format>" +
            "<blob-payload-request>" +
                "<blob-format>" +
                    "<blob-format-spec>inline</blob-format-spec>" +
                "</blob-format>" +
            "</blob-payload-request>" +						
        "</format>" + 
    "</group>" +
"</info>";

    Request request = new Request();
    request.setMethodName("GetThings");
    request.setMethodVersion("3");

(Note that you don't need to mess around with fancy imports or changing the method name; just use "3" for the method version)

HTH