how to get BP ,BG,Hight,Document or other thing from Health vaulth in Android

Aug 2, 2013 at 9:36 AM
private List<String> getWeights()
{
    Record record = selectedRecord;

    SimpleRequestTemplate template = new SimpleRequestTemplate(
            service.getConnection(),
            record.getPersonId(),
            record.getId());

    String info = "<info><group max=\"25\"><filter><type-id>" +
        Weight.TYPE +
        "</type-id></filter><format><section>core</section>" +
        "<xml/></format></group></info>";

    Request request = new Request();
    request.setMethodName("GetThings");
    request.setInfo(info);

    return (List<String>)template.makeRequest(request, new RequestMarshaller() {
        public Object marshal(InputStream istream) throws Exception {
            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
            factory.setNamespaceAware(false);
            XmlPullParser parser= factory.newPullParser();    
            parser.setInput(istream, "utf8");

            XmlUtils.nextStartTag(parser, "response");
            XmlUtils.nextStartTag(parser, "status");
            XmlUtils.skipSubTree(parser);
            XmlUtils.nextStartTag(parser, "wc:info");
            XmlUtils.nextStartTag(parser, "group");



            StringWriter writer = new StringWriter();
            IOUtils.copy(istream, writer, "utf8");
            String theString = writer.toString();

            Log.d("Read",theString+"abc");

            IOUtils.toString(istream, "utf8");

            Log.d("Read", IOUtils.toString(istream, "utf8")+"abc1");

            List<String> weights = new ArrayList<String>();

            while (parser.nextTag() == XmlPullParser.START_TAG) {
              if ("thing".equals(parser.getName())) {
                  int thingDepth = parser.getDepth();
                  while (parser.nextTag() == XmlPullParser.START_TAG
                          && parser.getDepth() > thingDepth) {
                      if ("data-xml".equals(parser.getName()))
                      {
                          int dataXmlDepth = parser.getDepth();
                          while (parser.nextTag() == XmlPullParser.START_TAG
                                  && parser.getDepth() > dataXmlDepth) {
                              if ("weight".equals(parser.getName())) {
                                  weights.add(
                                      String.valueOf(Weight.createFromXml(parser).getValue()));
                              } 
                              else {
                                  XmlUtils.skipSubTree(parser);
                              }
                          }
                      }
                      else
                      {
                          XmlUtils.skipSubTree(parser);
                      }
                  }
              } else {
                 XmlUtils.skipSubTree(parser);
              }
            }

            return weights;
        }
    });
}
Above method has taken from Android weight app Example
Any one can Explain :
  1. To get Height and BP what change will required in above method??????
  2. How can I print The response of above method. means Simply I have to print the response of which is come from health vault for weight request
    3.what is Info String in above method??
  3. I have tried to conver
    InputStream to String but I not get any String value.
where InputStream is " istream "of marshal(InputStream istream)

(weight-app gives correct result and working fine)
Coordinator
Aug 7, 2013 at 5:42 PM
Hi,
  1. To get Height and BP you will need to create your own application at https://config.healthvault-ppe.com, authorize it for the types you wish, and configure the application to use your application id.
  2. Printing. I'm not an Android expert but your approach to put the response in a String looks sound. However, the rest of the code will fail since you consumed the input stream. I'll have to try it out.
  3. "info" is the XML for the request.
Aug 8, 2013 at 8:13 AM
Edited Aug 8, 2013 at 8:16 AM
Thanks robmay for the help

I have few more query:

1>what will be our info (request String) for BP?

2>what should be the response xml for BP request?

3>I am trying to create my own application Id but I get error ..

"You won't be able to use Application Configuration Center because it restricts access based on account location. "

4> if i get success to create app id , can u explain the way to configure the application to use your application id.

5>in android weight app example of SDK they configure some think like that
    settings.setMasterAppId("c6ba979f-c342-4408-a2bc-0dfb43b2bf8d");
    settings.setServiceUrl("https://platform.healthvault-ppe.com/platform/wildcat.ashx");
    settings.setShellUrl("https://account.healthvault-ppe.com");



can any one tell me , For my app I have to just replace app Id only
OR
I have to put some other serviceurl and shell url.

6.what is the difference between
   ____For serviceurl____
    settings.setServiceUrl("https://platform.healthvault-ppe.com/platform/wildcat.ashx"); 
    ____AND____
    settings.setServiceUrl("https://platform.healthvault-ppe.co.uk/platform/wildcat.ashx"); 

 ____For shellurl____

       settings.setShellUrl("https://account.healthvault-ppe.com"); 
       ____AND____
       settings.setShellUrl("https://account.healthvault-ppe.co.uk/");
which url is appropriate for me(Android) ?
And witch url may use in witch condition?
Aug 8, 2013 at 3:30 PM
hi santosh, i also cant retrieve bloodpressure data, have you found a soln, plz reply.
Coordinator
Aug 8, 2013 at 8:57 PM
Hi,

I admit that I need more documentation here guys. Thanks for riding this out. There is some good documentation here:

Creating your own globally aware app
http://msdn.microsoft.com/en-us/library/dn269023.aspx

Blood Pressure
Until you have the configurations worked out, I added Blood Pressure to the sample application's rule set. You will need to reauthorize the application.

Requesting the type -- HealthVault uses type ids. In the request XML simply add the type id of the type you are interested in. The sample application is only authorized for Weight and Blood Pressure at this time. You can find all of the type ids and their XSDs here: http://developer.healthvault.com/pages/types/types.aspx
<info><group max=\"25\"><filter><type-id>" +
         + "ca3c57f4-f4c1-4e15-be67-0a3caf5414ed" +
        "</type-id></filter><format><section>core</section>" +
        "<xml/></format></group></info>";
Coordinator
Aug 8, 2013 at 9:02 PM
If you are outside of the US, use:

Config Center: config.healthvault-ppe.co.uk
ShellUrl: https://account.healthvault-ppe.co.uk
ServiceUrl: https://platform.healthvault-ppe.co.uk

If you are inside of the US, us:
Config Center: config.healthvault-ppe.com
ShellUrl: https://account.healthvault-ppe.com
ServiceUrl: https://platform.healthvault-ppe.com


If you can configure your application in both config centers, you can configure your application to be globally aware and automatically detect the best instance for your consumers. In order to use the US config center, your HealthVault account must say that you are within the US -- you can set it to whatever you like.

--Rob