SkinTemperatureRecord


class SkinTemperatureRecord : 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

Represents a skin temperature delta entry of SkinTemperatureRecord.

Constants

const Int

Skin temperature measurement was taken from finger.

const Int

Skin temperature measurement was taken from toe.

const Int

Use this if the location is unknown.

const Int

Skin temperature measurement was taken from wrist.

Public companion properties

AggregateMetric<TemperatureDelta>

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

AggregateMetric<TemperatureDelta>

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

AggregateMetric<TemperatureDelta>

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

Public constructors

SkinTemperatureRecord(
    startTime: Instant,
    startZoneOffset: ZoneOffset?,
    endTime: Instant,
    endZoneOffset: ZoneOffset?,
    deltas: List<SkinTemperatureRecord.Delta>,
    baseline: Temperature?,
    measurementLocation: Int,
    metadata: Metadata
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Temperature?

Temperature in Temperature unit.

List<SkinTemperatureRecord.Delta>

a list of skin temperature Delta.

open Instant

End time of the record.

open ZoneOffset?

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

Int

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

open Metadata

set of common metadata associated with the written record.

open Instant

Start time of the record.

open ZoneOffset?

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

Constants

MEASUREMENT_LOCATION_FINGER

const val MEASUREMENT_LOCATION_FINGER = 1: Int

Skin temperature measurement was taken from finger.

MEASUREMENT_LOCATION_TOE

const val MEASUREMENT_LOCATION_TOE = 2: Int

Skin temperature measurement was taken from toe.

MEASUREMENT_LOCATION_UNKNOWN

const val MEASUREMENT_LOCATION_UNKNOWN = 0: Int

Use this if the location is unknown.

MEASUREMENT_LOCATION_WRIST

const val MEASUREMENT_LOCATION_WRIST = 3: Int

Skin temperature measurement was taken from wrist.

Public companion properties

TEMPERATURE_DELTA_AVG

val TEMPERATURE_DELTA_AVGAggregateMetric<TemperatureDelta>

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

val TEMPERATURE_DELTA_MAXAggregateMetric<TemperatureDelta>

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

val TEMPERATURE_DELTA_MINAggregateMetric<TemperatureDelta>

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
SkinTemperatureRecord(
    startTime: Instant,
    startZoneOffset: ZoneOffset?,
    endTime: Instant,
    endZoneOffset: ZoneOffset?,
    deltas: List<SkinTemperatureRecord.Delta>,
    baseline: Temperature? = null,
    measurementLocation: Int = MEASUREMENT_LOCATION_UNKNOWN,
    metadata: Metadata = Metadata.EMPTY
)
Parameters
startTime: Instant

Start time of the record.

startZoneOffset: ZoneOffset?

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.

endTime: Instant

End time of the record.

endZoneOffset: ZoneOffset?

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.

deltas: List<SkinTemperatureRecord.Delta>

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

baseline: Temperature? = null

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

measurementLocation: Int = MEASUREMENT_LOCATION_UNKNOWN

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

metadata: Metadata = Metadata.EMPTY

set of common metadata associated with the written record.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

baseline

Added in 1.1.0-alpha10
val baselineTemperature?

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

deltas

Added in 1.1.0-alpha10
val deltasList<SkinTemperatureRecord.Delta>

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

endTime

Added in 1.1.0-alpha10
open val endTimeInstant

End time of the record.

endZoneOffset

Added in 1.1.0-alpha10
open val endZoneOffsetZoneOffset?

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.

measurementLocation

Added in 1.1.0-alpha10
val measurementLocationInt

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

metadata

Added in 1.1.0-alpha10
open val metadataMetadata

set of common metadata associated with the written record.

startTime

Added in 1.1.0-alpha10
open val startTimeInstant

Start time of the record.

startZoneOffset

Added in 1.1.0-alpha10
open val startZoneOffsetZoneOffset?

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.