locked
How I am get values of Calories burned,FatcoloriesBurned step_Count and When from Healthvault RRS feed

  • Question

  • Here I am creating Healtvault application for retrieving Exercise data from HV . Following code I have used for retrieve Exercise data from health vault and I can get record's also but only Activity , Distance and Duration values I got, and want value of Calories burned,FatcoloriesBurned step_Count and When  so please view this code and inform what change I have to do for get these value  

            Guid personId = new Guid("358defd1-7a5b-4023-8575-23cd6c503e52");
            Guid recordId = new Guid("e3512fa9-cfa9-4eaf-ab8f-e16722df0faa");



            OfflineWebApplicationConnection offlineConn = new OfflineWebApplicationConnection(personId);
            offlineConn.Authenticate();

            PersonInfo obj = offlineConn.GetPersonInfo();
            HealthRecordAccessor accessor = new HealthRecordAccessor(offlineConn, recordId);



            HealthRecordSearcher searcher = obj.SelectedRecord.CreateSearcher();
            HealthRecordFilter filter = new HealthRecordFilter(Exercise.TypeId);
            searcher.Filters.Add(filter);       
            HealthRecordItemCollection items = searcher.GetMatchingItems()[0];
            HealthRecordItem item = items[0]; //Here I have got Distance and Duration values
           
           foreach (Exercise exercise in items)
            {
                exercise.Activity;
                exercise.Distance;
                exercise.Duration;
                //exercise.Details; //I want details of exercise here
               
            }
           
    Thursday, April 29, 2010 6:22 AM

Answers

  • thanks Eric Gunnerson,

    Now I can get values of details of Exercise

    • Marked as answer by Ganesh Bhoi Friday, April 30, 2010 8:33 AM
    Friday, April 30, 2010 8:33 AM

All replies

  • Assuming that information exists in this exercise session, you can do something like:

    if (exercise.Details.ContainsKey(ExerciseDetails.CaloriesBurned_calories))
    {
        string calories = exercise.Details[ExerciseDetails.CaloriesBurned_calories];
    }

    The key for step count is ExerciseDetails.Steps_count. The when is just exercise.When.

    Finally, if you wan to know what values are stored in the details, you can do:

     

    foreach (string detailName in exercise.Details.Keys)
    {
        ...
    }

     

    Thursday, April 29, 2010 3:12 PM
  • thanks Eric Gunnerson,

    Now I can get values of details of Exercise

    • Marked as answer by Ganesh Bhoi Friday, April 30, 2010 8:33 AM
    Friday, April 30, 2010 8:33 AM