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.
Prefer typed Blueprint nodes
Section titled “Prefer typed Blueprint nodes”For a built-in type:
- Initialize
HealthBridgeSubsystem. - Call Read Data Type.
- Select the type from the dropdown.
- Set
Days BackandMax Records. - Check
bSuccessbefore readingSamples. - 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.
Query in C++
Section titled “Query in C++”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.
Handle empty and partial data
Section titled “Handle empty and partial data”bSuccess=false: show a recoverable error state.bSuccess=truewith 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.
