MeasureClient

interface MeasureClient


Client which provides a way to make measurements of health data on a device.

This is optimized for apps to register live callbacks on data which may be sampled at a faster rate; this is not meant to be used for long-lived subscriptions to data (for this, consider using ExerciseClient or PassiveMonitoringClient depending on your use case).

Existing subscriptions made with the PassiveMonitoringClient are also expected to get the data generated by this client.

Summary

Public fields

abstract @NonNull ListenableFuture<@NonNull MeasureCapabilities>

Returns the MeasureCapabilities of this client for the device.

Public methods

abstract @NonNull ListenableFuture<@NonNull Void>

Registers the app for live measurement of the specified DataType.

abstract @NonNull ListenableFuture<@NonNull Void>
registerCallback(
    DataType dataType,
    MeasureCallback callback,
    Executor executor
)

Same as registerCallback, except the callback is called on the given Executor.

abstract @NonNull ListenableFuture<@NonNull Void>

Unregisters the given MeasureCallback for updates of the given DataType.

Public fields

capabilities

abstract @NonNull ListenableFuture<@NonNull MeasureCapabilitiescapabilities

Returns the MeasureCapabilities of this client for the device.

Public methods

registerCallback

abstract @NonNull ListenableFuture<@NonNull VoidregisterCallback(DataType dataType, MeasureCallback callback)

Registers the app for live measurement of the specified DataType.

The callback will be called on the main application thread. To move calls to an alternative thread use registerCallback.

Even if data is registered for live capture, it can still be sent out in batches depending on the application processor state.

Registering a