Jake Hilborn
Jake Hilborn

Reputation: 321

Get real-time heart rate watchOS 4 without iPhone

I'm writing a heart rate BPM-alert application for the Apple Watch. Its function is to vibrate the watch when the user's heart rate is over some BPM threshold during a workout.

What is the most real-time way to get heart rate data on the watch? Beat-by-beat would be best but updates every ~5 seconds would suffice. I do not need any of this data on the iPhone since the only use I have is to vibrate the watch the moment BPM is too high. I'm targeting watchOS 4 on the Series 1.

Upvotes: 0

Views: 856

Answers (1)

Allan
Allan

Reputation: 7343

There is no API on watchOS to get beat-by-beat heart rate measurements, but you can stream live heart rate measurements with HKAnchoredObjectQuery. If you want your app to record heart rate in the background, even when the screen is off, then your app must start an HKWorkoutSession.

Upvotes: 0

Related Questions