This is a migrated thread and some comments may be shown as answers.

Query Heart Rate

1 Answer 105 Views
Sample Applications
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sathishkumar
Top achievements
Rank 1
sathishkumar asked on 13 Oct 2015, 01:54 PM

Could anyone please help with my requirement ? 

I have created a new hybrid application with healthkit plugin, but I can't see an example anywhere to query the heartRate data from IOS healthkit using the plugin. I tried to write my own JS 

   function queryHeartRate() {
    window.plugins.healthkit.queryHeartRate(
        {
          'startDate': new Date(new Date().getTime() - 4 * 24 * 60 * 60 * 1000), // four days ago
          'endDate': new Date(), // now
          'quantityType': 'HKQuantityTypeIdentifierHeartRate',
          'limit': '600',
          'unit': 'bpm' // make sure this is compatible with the sampleType
        },
        function (value) {
            alert("Heart Rate result " + value);
          },
        callback
    );
  }

But its not working. Cant see the results. I have checked the IOS examples to query the heartrate data and the params are right.

 I have seen the sample application build (https://github.com/Telerik-Verified-Plugins/HealthKit/). But not much related to heartrate data.

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 16 Oct 2015, 12:16 PM
Hello Sathishkumar,

Make sure you go through all the instructions in the HealthKit plugin page. First, there are certain requirements that you need to make sure are met. They are listed in the Important  section.

Then, note that the method that you need to use is querySampleType​, as described and shown in the section Reading any other HealthKit data. The method determines the needed data from the sampleType value that you pass.

Additionally, make sure that you are testing your app directly on a device. Plugins from the Marketplace (and any other custom plugins) work only when deployed directly on a device, they don't work in the Simulator and the companion apps.

Regards,
Tsvetina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Sample Applications
Asked by
sathishkumar
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or