Files
HealthTracking/docs/superpowers/specs/2026-06-08-fightrate-rn-background-capture-redesign.md

1.7 KiB

FightRate RN — Background Capture + Corner Instrument Redesign

Objective

Make the bare React Native Android app capture heart-rate data continuously until the athlete manually stops the workout, including when the screen is locked or the app is backgrounded. Replace foreground-JS BLE ownership and generic card UI with native Android capture ownership, local SQLite persistence, and Corner Instrument screens.

Success Criteria

  • Capture is started/stopped from React Native, but BLE scan/connect/monitor runs in an Android foreground service.
  • Android manifest declares Bluetooth, notification, foreground service, and battery optimization permissions needed for continuous capture.
  • The foreground service repeats scan/reconnect attempts unless stopped manually.
  • Heart Rate Service 180D and Heart Rate Measurement 2A37 are used for real BLE BPM data.
  • Each BPM sample is timestamped and persisted locally in SQLite.
  • History and insights use persisted real sessions/samples; no mock BPM/history/insight data is displayed.
  • UI follows FIGHTRATE_DESIGN_SYSTEM.md / Corner Instrument: dark physical instrument surfaces, dominant BPM, technical strips, no nested generic card dashboard.
  • Release APK builds as an installable arm64 artifact and is sent to Telegram.

Boundaries

  • React Native bare CLI only; no Expo.
  • Android-first implementation; iOS background BLE is out of scope.
  • Physical Magene H003 validation remains required on device.
  • Manual destructive deletion of non-design project files is avoided.

Verification

  • npm run typecheck
  • npm run lint
  • npm test -- --runInBand
  • npm audit --audit-level=moderate
  • cd FightRateRN/android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a