Recommended approach to show the heart rate data from the watch in host app?

I have a use case where the watch app and the host app (on the iPhone) are both running on the foreground, and I would like to display the live Heart Rate on the iPhone. I can access and display the Heart Rate on the watch by following the WWDC '15 “What's New in HeathKit” session.


What would be the best approach to get this data onto the iPhone. Should I just run a HealthKit query on the iPhone or pass the information through the new Watch Connectivity framework? How fast would the HealthKit data sync over?

Hi Stacconi,


Yes, to get the heart rate samples though to the phone you will need to have a HealthKit query for the samples and, according to the WWDC video you mentioned, the phone will receive a refresh of the heartbeat every ~4 seconds.


This project will give you a good overview:

github.com/coolioxlr/watchOS-2-heartrate


Max.

I’ve tested the approach of running a HealthKit query for the Heart Rate on the iPhone, but this does not work on iOS9 beta 5. Specifically the updateHandler does not get called when the Heart Rate data is coming from the Apple Watch (even while an HKWorkoutSession is in progress on the watch). This works fine if a 3rd party heart rate sensor/monitor is used.


I’ve tried with both types of queries, HKObserverQuery and HKAnchoredObjectQuery, and both had the same result.


Reading the Heart Rate through HealthKit on the Watch Extension works fine, it’s just on the iPhone that I’m having problems with. The updateHandlers don’t appear to get called. Any ideas?

same problems - updateHandler is just called once at beginning and again after the workout ended providing all the missing samples.

Hi Stacconi,


Same here. Do you have any update or fix on this issue?


Regards,

Taurus

Did anyone find a workaround for this? I've tried it again with iOS 9 GM and watchOS 2 beta (13S343) and still get the same behavior. I've added a radar.

updateHandler and HKObserverQuery are also still not working in GM for me 😐

Using a timer to execute a query every second works but only if app is in foreground.

Samething here. HKObserverQuery is not working properly!

Recommended approach to show the heart rate data from the watch in host app?
 
 
Q