MeasureCallback

interface MeasureCallback


Callback for MeasureClient.registerMeasureCallback.

Summary

Public functions

Unit
onAvailabilityChanged(
    dataType: DeltaDataType<*, *>,
    availability: Availability
)

Called when the availability of a DataType changes.

Unit

Called when new data is available.

open Unit

Called when this callback has been successfully registered with Health Services.

open Unit

Called when Health Services reports a failure with the registration of this callback.

Public functions

onAvailabilityChanged

Added in 1.0.0
fun onAvailabilityChanged(
    dataType: DeltaDataType<*, *>,
    availability: Availability
): Unit

Called when the availability of a DataType changes.

Parameters
dataType: DeltaDataType<*, *>

the DeltaDataType that experienced a change in availability

availability: Availability

the new Availability status for this dataType

onDataReceived

Added in 1.0.0
fun onDataReceived(data: DataPointContainer): Unit

Called when new data is available. Data may be batched.

Parameters
data: DataPointContainer

the (potentially batched) set of measured DataPoints corresponding to one or more of the requested DeltaDataTypes

onRegistered

Added in 1.0.0
open fun onRegistered(): Unit

Called when this callback has been successfully registered with Health Services.

onRegistrationFailed

Added in 1.0.0
open fun onRegistrationFailed(throwable: Throwable): Unit

Called when Health Services reports a failure with the registration of this callback. Common causes include: the calling app lacks the necessary permission, or the device does not support the requested DataType.

Parameters
throwable: Throwable

a throwable sent by Health Services with information about the failure