How to detect when Apple Watch is removed from wrist during active workout session?

I'm currently collecting real-time heart rate data using HKWorkoutSession. I want to track when the Apple Watch is physically removed from the user's wrist during an active workout.

However, I've noticed that workoutBuilder(_:didCollectDataOf:) continues to be called even after the watch is removed from the wrist.

Is there a way to detect when the Apple Watch is removed from the wrist during an active HKWorkoutSession? Or is this tracking not possible through the HealthKit framework?

Any guidance or alternative approaches would be appreciated.

Answered by DTS Engineer in 872472022

There is no public API for wrist detection at real time. For non-real-time detection, here is what we have:

I won't say that HealthKit's delivering heart rate samples after the watch being removed from the wrist is expected – That's probably just a result that the system isn't really sure if the watch is on the wrist or not. I’d suggest that you file a feedback report against that – If you do so, please share your report ID here.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Is detecting Apple Watch wrist removal during an active HKWorkoutSession explicitly supported by any public HealthKit or watchOS API?

If not, should the continued delivery of heart rate samples after wrist removal be considered expected behavior?

There is no public API for wrist detection at real time. For non-real-time detection, here is what we have:

I won't say that HealthKit's delivering heart rate samples after the watch being removed from the wrist is expected – That's probably just a result that the system isn't really sure if the watch is on the wrist or not. I’d suggest that you file a feedback report against that – If you do so, please share your report ID here.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

How to detect when Apple Watch is removed from wrist during active workout session?
 
 
Q