Wear OS: live heart rate during workouts (with recovery-based rest timer)

Open
#521 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
44/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
android, dart, flutter
Domain
mobile

Research direction

Start by reading the Wear OS WearSession screen and the existing Kotlin platform bridges; the issue proposes HeartBridge.kt with an EventChannel and MeasureClient for the first step. Check the Android manifest permissions and available Wear OS health service support. Done for step 1 means live BPM appears during an on-screen workout; recovery rest timing, summaries, and background recording are broader follow-up work.

Written by the indexing model from the issue text.

Description

enhancement

What I'd like

Live heart rate on the watch app during a workout, read straight from the watch's sensor.

Right now heart rate only shows up after the workout, when the phone pulls it from Health Connect into hrAvg / hrMax. That needs Android 14+ and another app writing heart rate to Health Connect. Reading it on the watch would make it work for every watch user, live, with nothing else installed.

Where it goes

  • Workout screen (WearSession): current BPM next to the elapsed time in the header row. Optionally, the _EdgeRing takes on the color of the current heart rate zone.
  • Rest timer: an option to end rest (or buzz) when heart rate has recovered, meaning it has dropped below a set BPM or fallen a set amount from the last set's peak, instead of only after a fixed time. This is the part I'm most excited about. Few strength apps do it, and it fits lifting better than cardio-style zones.
  • Session summary: the watch fills hrAvg / hrMax itself. The phone's Health Connect lookup only runs when hrAvg == null, so the watch's numbers would just win, and the fields already sync as hra / hrm.
  • Later: peak heart rate per set (a new optional field on LoggedSet), live heart rate on the tile/complication, and heart rate in FIT export / RouteSample.hr for cardio.

How it could work

  • Wear OS Health Services (androidx.health:health-services-client). It's part of Wear OS 3+ and runs fully on-device: no internet, account or Play Services. So it should fit the app's offline rules.
  • A small HeartBridge.kt streaming BPM to Flutter over an EventChannel, like the existing bridges.
  • Step 1, MeasureClient: live heart rate only while the app is on screen. Small and low-risk.
  • Step 2, ExerciseClient: keeps recording with the screen off and gives average/max. It needs a foreground service, and only one app can run a workout at a time, so it would end a Samsung Health workout that's already running.
  • Permissions: android.permission.health.READ_HEART_RATE is already in the manifest. Add BODY_SENSORS with maxSdkVersion="35" for Wear OS 5.1 and older. Only turn the feature on for watches on API 30+ that have the sensor, since minSdk is 24.

Caveats

  • Wrist heart rate lags and gets noisy during heavy, grip-intensive sets. It's most reliable between sets, which is why the recovery-based rest timer is the core of this.
  • Only sync summaries (average, max, per-set peak), not raw readings, to keep the Bluetooth sync small.

Happy to help test, or open a PR for step 1 if this sounds good.

Dominant language
Dart
Stars
844
Forks
98
Avg merge
1d 2h
Merged PRs (30d)
23

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from InlitX/GymMane

All issues in InlitX/GymMane

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.