MindfulnessSessionRecord


@ExperimentalMindfulnessSessionApi
public final class MindfulnessSessionRecord implements Record


Captures any mindfulness session a user does. This can be mindfulness sessions like meditation, breathing.

Each record needs a start time and end time. Records don't need to be back-to-back or directly after each other, there can be gaps in between.

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_MINDFULNESS_SESSION as an argument.

Summary

Constants

static final int

Guided breathing mindfulness session.

static final int

Meditation mindfulness session.

static final int

Stretches/movement mindfulness session.

static final int

Music/soundscapes mindfulness session.

static final int

Unguided mindfulness session.

static final int

Can be used to represent any generic mindfulness session that does not fall into a specific category.

Public fields

static final @NonNull AggregateMetric<@NonNull Duration>

Metric identifier to retrieve the total mindfulness session duration from androidx.health.connect.client.aggregate.AggregationResult.

Public constructors

MindfulnessSessionRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull Metadata metadata,
    int mindfulnessSessionType,
    String title,
    String notes
)

Public methods

boolean
equals(Object other)
@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.

final int

Type of mindfulness session (e.g. meditation, breathing, including unknown type).

final String

Additional notes for the session.

@NonNull Instant

Start time of the record.

ZoneOffset

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

final String

Title of the session.

int
@NonNull String

Constants

MINDFULNESS_SESSION_TYPE_BREATHING

public static final int MINDFULNESS_SESSION_TYPE_BREATHING = 2

Guided breathing mindfulness session.

MINDFULNESS_SESSION_TYPE_MEDITATION

public static final int MINDFULNESS_SESSION_TYPE_MEDITATION = 1

Meditation mindfulness session.

MINDFULNESS_SESSION_TYPE_MOVEMENT

public static final int MINDFULNESS_SESSION_TYPE_MOVEMENT = 4

Stretches/movement mindfulness session.

MINDFULNESS_SESSION_TYPE_MUSIC

public static final int MINDFULNESS_SESSION_TYPE_MUSIC = 3

Music/soundscapes mindfulness session.

MINDFULNESS_SESSION_TYPE_UNGUIDED

public static final int MINDFULNESS_SESSION_TYPE_UNGUIDED = 5

Unguided mindfulness session.

MINDFULNESS_SESSION_TYPE_UNKNOWN

public static final int MINDFULNESS_SESSION_TYPE_UNKNOWN = 0

Can be used to represent any generic mindfulness session that does not fall into a specific category. Any unknown new value definition will also fall automatically into MINDFULNESS_SESSION_TYPE_UNKNOWN.

Use this type if the mindfulness session type is unknown.

Public fields

MINDFULNESS_DURATION_TOTAL

public static final @NonNull AggregateMetric<@NonNull DurationMINDFULNESS_DURATION_TOTAL

Metric identifier to retrieve the total mindfulness session duration from androidx.health.connect.client.aggregate.AggregationResult. To check if this metric is available, use HealthConnectFeatures.getFeatureStatus with HealthConnectFeatures.FEATURE_MINDFULNESS_SESSION as the argument.

Public constructors

MindfulnessSessionRecord

Added in 1.1.0-beta02
public MindfulnessSessionRecord(
    @NonNull Instant startTime,
    ZoneOffset startZoneOffset,
    @NonNull Instant endTime,
    ZoneOffset endZoneOffset,
    @NonNull Metadata metadata,
    int mindfulnessSessionType,
    String title,
    String notes
)

Public methods

equals

public boolean equals(Object other)

getEndTime

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

End time of the record.

getEndZoneOffset

Added in 1.1.0-beta02
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.

getMindfulnessSessionType

Added in 1.1.0-beta02
public final int getMindfulnessSessionType()

Type of mindfulness session (e.g. meditation, breathing, including unknown type).

getNotes

Added in 1.1.0-beta02
public final String getNotes()

Additional notes for the session.

getStartTime

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

Start time of the record.

getStartZoneOffset

Added in 1.1.0-beta02
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.

getTitle

Added in 1.1.0-beta02
public final String getTitle()

Title of the session.

hashCode

public int hashCode()

toString

public @NonNull String toString()