ActivityIntensityRecord


public final class ActivityIntensityRecord implements Record


Represents intensity of an activity.

Intensity can be either moderate or vigorous.

Each record requires the start time, the end time and the activity intensity type.

The ability to insert or read this record type is dependent on the version of Health Connect installed on the device. To check if available: call HealthConnectFeatures.getFeatureStatus and pass HealthConnectFeatures.FEATURE_ACTIVITY_INTENSITY as an argument.

Summary

Constants

static final int

Moderate intensity activity

static final int

Vigorous intensity activity.

Public fields

static final @NonNull AggregateMetric<@NonNull Duration>

Metric identifier to retrieve the total duration of activity intensity regardless of the type from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull Duration>

Metric identifier to retrieve the number of weighted intensity minutes from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull Duration>

Metric identifier to retrieve the total duration of moderate activity intensity from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull Duration>

Metric identifier to retrieve the total duration of vigorous activity intensity from androidx.health.connect.client.aggregate.AggregationResult.

Public constructors

ActivityIntensityRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull Metadata metadata,
    int activityIntensityType
)

Public methods

boolean
equals(Object other)
final int

Type of activity intensity (moderate or vigorous).

@NonNull Instant

End time of the record.

ZoneOffset

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

@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

ACTIVITY_INTENSITY_TYPE_MODERATE

public static final int ACTIVITY_INTENSITY_TYPE_MODERATE = 0

Moderate intensity activity

ACTIVITY_INTENSITY_TYPE_VIGOROUS

public static final int ACTIVITY_INTENSITY_TYPE_VIGOROUS = 1

Vigorous intensity activity.

Public fields

DURATION_TOTAL

public static final @NonNull AggregateMetric<@NonNull DurationDURATION_TOTAL

Metric identifier to retrieve the total duration of activity intensity regardless of the type from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_ACTIVITY_INTENSITY as the argument.

INTENSITY_MINUTES_TOTAL

public static final @NonNull AggregateMetric<@NonNull DurationINTENSITY_MINUTES_TOTAL

Metric identifier to retrieve the number of weighted intensity minutes from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_ACTIVITY_INTENSITY as the argument.

MODERATE_DURATION_TOTAL

public static final @NonNull AggregateMetric<@NonNull DurationMODERATE_DURATION_TOTAL

Metric identifier to retrieve the total duration of moderate activity intensity from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_ACTIVITY_INTENSITY as the argument.

VIGOROUS_DURATION_TOTAL

public static final @NonNull AggregateMetric<@NonNull DurationVIGOROUS_DURATION_TOTAL

Metric identifier to retrieve the total duration of vigorous activity intensity from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_ACTIVITY_INTENSITY as the argument.

Public constructors

ActivityIntensityRecord

Added in 1.2.0-alpha01
public ActivityIntensityRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull Metadata metadata,
    int activityIntensityType
)

Public methods

equals

public boolean equals(Object other)

getActivityIntensityType

Added in 1.2.0-alpha01
public final int getActivityIntensityType()

Type of activity intensity (moderate or vigorous).

getEndTime

Added in 1.2.0-alpha01
public @NonNull Instant getEndTime()

End time of the record.

getEndZoneOffset

Added in 1.2.0-alpha01
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.

getMetadata

public @NonNull Metadata getMetadata()

Set of common metadata associated with the written record.

getStartTime

Added in 1.2.0-alpha01
public @NonNull Instant getStartTime()

Start time of the record.

getStartZoneOffset

Added in 1.2.0-alpha01
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()