SkinTemperatureRecord


public final class SkinTemperatureRecord implements Record


Captures the skin temperature of a user. Each record can represent a series of measurements of temperature differences.

The ability to insert or read this record type is dependent on the version of HealthConnect installed on the device. To check if available: call HealthConnectFeatures.getFeatureStatus and pass HealthConnectFeatures.FEATURE_SKIN_TEMPERATURE as an argument. See further down for an example on how to read skin temperature.

import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.permission.HealthPermission
import androidx.health.connect.client.readRecord
import androidx.health.connect.client.records.SkinTemperatureRecord
import androidx.health.connect.client.request.ReadRecordsRequest
import androidx.health.connect.client.time.TimeRangeFilter

if (
    healthConnectClient.features.getFeatureStatus(
        HealthConnectFeatures.FEATURE_SKIN_TEMPERATURE
    ) == HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    if (
        healthConnectClient.permissionController
            .getGrantedPermissions()
            .contains(HealthPermission.getReadPermission(SkinTemperatureRecord::class))
    ) {
        val response =
            healthConnectClient.readRecords(
                ReadRecordsRequest<SkinTemperatureRecord>(
                    timeRangeFilter = TimeRangeFilter.between(startTime, endTime)
                )
            )
        for (skinTemperatureRecord in response.records) {
            // Process each skin temperature record
        }
    } else {
        // Permission hasn't been granted. Request permission to read skin temperature.
    }
} else {
    // Feature is not available. It is not possible to read skin temperature.
}
Throws
kotlin.IllegalArgumentException

if startTime endTime or deltas are not within the record time range or baseline is not within MIN_TEMPERATURE, MAX_TEMPERATURE.

Summary

Nested types

public final class SkinTemperatureRecord.Delta

Represents a skin temperature delta entry of SkinTemperatureRecord.

Constants

static final int

Skin temperature measurement was taken from finger.

static final int

Skin temperature measurement was taken from toe.

static final int

Use this if the location is unknown.

static final int

Skin temperature measurement was taken from wrist.

Public fields

static final @NonNull AggregateMetric<@NonNull TemperatureDelta>

Metric identifier for retrieving the average skin temperature delta from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull TemperatureDelta>

Metric identifier for retrieving the maximum skin temperature delta from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull TemperatureDelta>

Metric identifier for retrieving the minimum skin temperature delta from androidx.health.connect.client.aggregate.AggregationResult.

Public constructors

SkinTemperatureRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull List<@NonNull SkinTemperatureRecord.Delta> deltas,
    Temperature baseline,
    int measurementLocation,
    @NonNull Metadata metadata
)

Public methods

boolean
equals(Object other)
final Temperature

Temperature in Temperature unit.

final @NonNull List<@NonNull SkinTemperatureRecord.Delta>

a list of skin temperature Delta.

@NonNull Instant

End time of the record.

ZoneOffset

User experienced zone offset at endTime, or null if unknown.

final int

indicates the location on the body from which the temperature reading was taken.

@NonNull Metadata

set of common metadata associated with the written record.

@NonNull Instant

Start time of the record.

ZoneOffset

User experienced zone offset at startTime, or null if unknown.

int
@NonNull String

Constants

MEASUREMENT_LOCATION_FINGER

public static final int MEASUREMENT_LOCATION_FINGER = 1

Skin temperature measurement was taken from finger.

MEASUREMENT_LOCATION_TOE

public static final int MEASUREMENT_LOCATION_TOE = 2

Skin temperature measurement was taken from toe.

MEASUREMENT_LOCATION_UNKNOWN

public static final int MEASUREMENT_LOCATION_UNKNOWN = 0

Use this if the location is unknown.

MEASUREMENT_LOCATION_WRIST

public static final int MEASUREMENT_LOCATION_WRIST = 3

Skin temperature measurement was taken from wrist.

Public fields

TEMPERATURE_DELTA_AVG

public static final @NonNull AggregateMetric<@NonNull TemperatureDeltaTEMPERATURE_DELTA_AVG

Metric identifier for retrieving the average skin temperature delta from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_SKIN_TEMPERATURE as the argument.

TEMPERATURE_DELTA_MAX

public static final @NonNull AggregateMetric<@NonNull TemperatureDeltaTEMPERATURE_DELTA_MAX

Metric identifier for retrieving the maximum skin temperature delta from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_SKIN_TEMPERATURE as the argument.

TEMPERATURE_DELTA_MIN

public static final @NonNull AggregateMetric<@NonNull TemperatureDeltaTEMPERATURE_DELTA_MIN

Metric identifier for retrieving the minimum skin temperature delta from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_SKIN_TEMPERATURE as the argument.

Public constructors

SkinTemperatureRecord

Added in 1.1.0-alpha10
public SkinTemperatureRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull List<@NonNull SkinTemperatureRecord.Delta> deltas,
    Temperature baseline,
    int measurementLocation,
    @NonNull Metadata metadata
)
Parameters
@NonNull Instant startTime

Start time of the record.

ZoneOffset startZoneOffset

User experienced zone offset at startTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

@NonNull Instant endTime

End time of the record.

ZoneOffset endZoneOffset

User experienced zone offset at endTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

@NonNull List<@NonNull SkinTemperatureRecord.Delta> deltas

a list of skin temperature Delta. If baseline is set, these values are expected to be relative to it.

Temperature baseline

Temperature in Temperature unit. Optional field, null by default. Valid range: 0-100 Celsius degrees.

int measurementLocation

indicates the location on the body from which the temperature reading was taken. Optional field, MEASUREMENT_LOCATION_UNKNOWN by default. Allowed values: SkinTemperatureMeasurementLocation.

@NonNull Metadata metadata

set of common metadata associated with the written record.

Public methods

equals

public boolean equals(Object other)

getBaseline

Added in 1.1.0-alpha10
public final Temperature getBaseline()

Temperature in Temperature unit. Optional field, null by default. Valid range: 0-100 Celsius degrees.

getDeltas

Added in 1.1.0-alpha10
public final @NonNull List<@NonNull SkinTemperatureRecord.DeltagetDeltas()

a list of skin temperature Delta. If baseline is set, these values are expected to be relative to it.

getEndTime

Added in 1.1.0-alpha10
public @NonNull Instant getEndTime()

End time of the record.

getEndZoneOffset

Added in 1.1.0-alpha10
public ZoneOffset getEndZoneOffset()

User experienced zone offset at endTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

getMeasurementLocation

Added in 1.1.0-alpha10
public final int getMeasurementLocation()

indicates the location on the body from which the temperature reading was taken. Optional field, MEASUREMENT_LOCATION_UNKNOWN by default. Allowed values: SkinTemperatureMeasurementLocation.

getMetadata

Added in 1.1.0-alpha10
public @NonNull Metadata getMetadata()

set of common metadata associated with the written record.

getStartTime

Added in 1.1.0-alpha10
public @NonNull Instant getStartTime()

Start time of the record.

getStartZoneOffset

Added in 1.1.0-alpha10
public ZoneOffset getStartZoneOffset()

User experienced zone offset at startTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

hashCode

public int hashCode()

toString

public @NonNull String toString()