Skip to content

Unity API reference

  • HealthBridge
  • HealthBridge.Data
  • HealthBridge.Helpers
Type Purpose
HealthBridgeService Static provider lifecycle and data operations
HealthBridgeInitializer Platform-aware MonoBehaviour; required in Android players
IHealthProvider Common provider contract
IWorkoutRouteProvider Optional route extension
IHealthDeleteProvider Optional deletion extension
HealthBridgeSettings Permissions, platform text, and editor configuration
HealthDataTypeRegistry Unified type and permission metadata
HealthBridgeEvents Main-thread lifecycle and operation events
WorkoutImporter Workout import and progress workflow
  • PrewarmAsync
  • AutoInitializeAsync
  • ReadDataAsync
  • WriteDataAsync
  • WriteWorkoutAsync
  • DeleteDataAsync and DeleteWorkoutAsync
  • GetWorkoutRouteAsync
  • PublishHeartRateSample
  • IsReady and Provider

AutoInitializeAsync supports the editor and iOS; Android players require HealthBridgeInitializer.

Always check Success before consuming results:

  • HealthDataQuery and HealthDataReadResult
  • HealthDataWriteQuery and HealthDataWriteResult
  • HealthDataDeleteQuery and HealthDataDeleteResult
  • WorkoutRouteReadResult
  • PermissionResult

Read results can succeed with zero samples. Route results can require additional user consent.

HealthBridgeEvents exposes provider, permission, workout import, heart-rate, read, write, and delete lifecycle events. Events are delivered on the Unity main thread.

Subscribe in OnEnable and unsubscribe in OnDisable.

Use HealthBridgeService.Provider.Supports(HealthCapability) before exposing optional write, delete, route, monitoring, or specialized data UI.

HealthDataQuery defaults to seven days and 100 records. Days clamp to 1–90 and record count to at least one.

  • WorkoutImporter and ImportOptions
  • ExerciseTypeMapper
  • HealthDataTypeRegistry
  • Typed sample computed date, duration, and unit properties

See data types and units and errors and recovery.