HKWorkoutSession not getting HeartRate samples when screen locked.

I am starting a HKWorkoutSession and querying for heart rate samples. I attach an updateHandler but I stop receiving heart rate when the screen locks (I lower my wrist).


Is this expected behaviour or a bug?

After you wake the watch do you recieve the heart rate samples taken during the time that the screen was locked?


My understanding was that the samples will be generated while the screen is locked (in a previous beta as @Max108 mentioned this was not happening and was a bug), but the samples won't be delivered to 3rd party apps until the device is woke by the user. Then you would get a flood of samples for the time since you last got samples. This was to prevent 3rd party apps from doing any processing while the device is sleeping.

I receive one sample that says about 1.85 which is wierd.


Ok thanks for your answer. I will see if I can get the samples when the clock wakes again.

So there no way to monitor heart rate data in real time then? Except when the watch is awake?

This WWDC session may help clarify things, at around 26m25s: https://developer.apple.com/videos/wwdc/2015/?id=105


You will obviously need to tailor your HealthKit queries to retrieve all the data that was recorded while your app was in the background.

HKWorkoutSession not getting HeartRate samples when screen locked.
 
 
Q