Query Heart Rate

2 posts, 0 answers
  1. sathishkumar
    sathishkumar avatar
    1 posts
    Member since:
    Sep 2015

    Posted 13 Oct 2015 Link to this post

    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.

  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 16 Oct 2015 Link to this post

    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
Back to Top