Setup and connection
Streams live heart rate and inter-beat intervals (IBI) from a Galaxy Watch6 over local Wi-Fi to a C# receiver. Includes a Windows monitor and watch installer. No cloud service or automatic recording.
Build
Run the following commands from HeartbeatApp/.
Requires the .NET 8 SDK, JDK 17, Android SDK 35, and Samsung Health Sensor SDK 1.4.1. Place samsung-health-sensor-api.aar in Watch/app/libs/.
dotnet build Heartbeat.sln -c Release
dotnet test Heartbeat.sln -c Release
cd Watch
.\gradlew.bat :app:assembleDebug
Rider builds and runs dist/HeartbeatDemo/Dizzy.Heartbeat.Demo.exe. The Windows x64 build includes its .NET runtime. Build the watch APK before rebuilding the demo to copy the latest APK into dist.
Connect
- Open the demo, select the PC's LAN address, and start listening (TCP 47651). Allow inbound access on a trusted private network.
- On the watch, enable Wireless debugging and Health Sensor Service developer mode.
- In Set up watch (ADB), enter the current debugging address and install. Enable Pair ADB first only if the computer isn't already authorized.
- On the watch, approve the PC, start sharing, and grant sensor permissions.
The watch uses a foreground health service for screen-off tracking. Android may still stop it; long-running behavior requires testing on the device.
Library and data
Dizzy.Heartbeat.dll targets .NET Standard 2.1 for Unity and other C# applications. Create or load a ReceiverIdentity, start HeartbeatReceiver.RunAsync, and poll TryDequeue on the consumer thread. Cancel and await the receiver task before disposing its certificate.
Samples include SDK status codes and validity information. IBI status -1 invalidates that interval, not necessarily the BPM reading. Treat stale or invalid samples as unavailable.
Pairing credentials are stored under dist/HeartbeatDemo/Pairings/. Keep that directory private and move the entire demo folder when transferring installations.