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 static type, schema, and permission metadata
HealthDataTypeCapability Runtime state and reason for one registry type
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.GetDataTypeCapabilities() to enumerate every registry row for the active platform. Use GetDataTypeCapability(id) before one read or write. The returned HealthDataTypeCapability includes CanRead, CanWrite, Availability, and a user-presentable Reason when the operation is disabled.

HealthDataTypeInfo.GetFields(platform) provides the fields, units, bounds, and legal category values for schema-driven forms. This is the supported way to build a complete type picker without hard-coding a list.

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.