onResult
onResult is the handoff from the Bluetooth runtime to application code. It receives the reading's device metadata, normalized measurement data, and a stable identity.
<BTProvider
{...providerProps}
onResult={(result) => {
const idempotencyKey = result.id;
const payload = {
device: result.deviceData,
measurement: result.data,
};
void persistAndUpload(payload, { idempotencyKey });
}}
/>
The id is stable when a device sends the same stored reading again. It is enumerable and non-writable at runtime, so object spreads and JSON serialization include it. Use it as an idempotency key if uploads can be retried.
data is a normalized measurement without the device-internal caseType. The result type is narrowed by the provider's acceptedDevices tuple. Validate and associate the result with the correct app user before persistence or upload.
See measurement events in the Bluetooth guide and background delivery.