Skip to content

Read health data

HealthBridge returns generic records as FHealthDataSample. Every sample carries a unified type ID, time range, source, record ID, ownership flag, and a Values map.

For a built-in type:

  1. Initialize HealthBridgeSubsystem.
  2. Call Read Data Type.
  3. Select the type from the dropdown.
  4. Set Days Back and Max Records.
  5. Check bSuccess before reading Samples.
  6. Use Get Health Data Sample Number or Get Health Data Sample String to retrieve values safely.

Use raw string IDs only for a custom or newly added registry type that is not yet represented by the Blueprint enum.

const FHealthDataQuery Query(TEXT("steps"), 7, 100);
FHealthBridgeService::ReadData(
Query,
[](const FHealthDataReadResult& Result)
{
if (!Result.bSuccess)
{
return;
}
for (const FHealthDataSample& Sample : Result.Samples)
{
const double Count = Sample.GetNumber(TEXT("count"));
// Update a transient view model.
}
});

Queries accept 1–90 days and at least one result. Large windows and result limits should be justified by the feature instead of requested by default.

Read the registry before building dynamic UI

Section titled “Read the registry before building dynamic UI”

Use FHealthDataTypeRegistry or Blueprint registry helpers to inspect:

  • Display name and category.
  • Platform support.
  • Public API status.
  • Write support.
  • Android and iOS permission mappings.

A registry row can exist for permission configuration without guaranteeing a typed public read/write path. Check the public API status and provider capability.

  • bSuccess=false: show a recoverable error state.
  • bSuccess=true with zero samples: show an empty state, not an error.
  • Missing value key: treat the field as unavailable.
  • Unknown source: keep the record usable without inventing attribution.
  • iOS empty read: do not infer that the player has no records or granted access.