MindfulnessSessionRecord


@ExperimentalMindfulnessSessionApi
class MindfulnessSessionRecord : 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

const Int

Guided breathing mindfulness session.

const Int

Meditation mindfulness session.

const Int

Stretches/movement mindfulness session.

const Int

Music/soundscapes mindfulness session.

const Int

Unguided mindfulness session.

const Int

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

Public companion properties

AggregateMetric<Duration>

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

Public constructors

MindfulnessSessionRecord(
    startTime: Instant,
    startZoneOffset: ZoneOffset?,
    endTime: Instant,
    endZoneOffset: ZoneOffset?,
    metadata: Metadata,
    mindfulnessSessionType: Int,
    title: String?,
    notes: String?
)

Public functions

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

Public properties

open Instant

End time of the record.

open ZoneOffset?

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

open Metadata

Set of common metadata associated with the written record.

Int

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

String?

Additional notes for the session.

open Instant

Start time of the record.

open ZoneOffset?

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

String?

Title of the session.

Constants

MINDFULNESS_SESSION_TYPE_BREATHING

const val MINDFULNESS_SESSION_TYPE_BREATHING = 2: Int

Guided breathing mindfulness session.

MINDFULNESS_SESSION_TYPE_MEDITATION

const val MINDFULNESS_SESSION_TYPE_MEDITATION = 1: Int

Meditation mindfulness session.

MINDFULNESS_SESSION_TYPE_MOVEMENT

const val MINDFULNESS_SESSION_TYPE_MOVEMENT = 4: Int

Stretches/movement mindfulness session.

MINDFULNESS_SESSION_TYPE_MUSIC

const val MINDFULNESS_SESSION_TYPE_MUSIC = 3: Int

Music/soundscapes mindfulness session.

MINDFULNESS_SESSION_TYPE_UNGUIDED

const val MINDFULNESS_SESSION_TYPE_UNGUIDED = 5: Int

Unguided mindfulness session.

MINDFULNESS_SESSION_TYPE_UNKNOWN

const val MINDFULNESS_SESSION_TYPE_UNKNOWN = 0: Int

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 companion properties

MINDFULNESS_DURATION_TOTAL

val MINDFULNESS_DURATION_TOTALAggregateMetric<Duration>

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
MindfulnessSessionRecord(
    startTime: Instant,
    startZoneOffset: ZoneOffset?,
    endTime: Instant,
    endZoneOffset: ZoneOffset?,
    metadata: Metadata,
    mindfulnessSessionType: Int,
    title: String? = null,
    notes: String? = null
)

Public functions

equals

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

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

endTime

Added in 1.1.0-beta02
open val endTimeInstant

End time of the record.

endZoneOffset

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

metadata

open val metadataMetadata

Set of common metadata associated with the written record.

mindfulnessSessionType

Added in 1.1.0-beta02
val mindfulnessSessionTypeInt

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

notes

Added in 1.1.0-beta02
val notesString?

Additional notes for the session.

startTime

Added in 1.1.0-beta02
open val startTimeInstant

Start time of the record.

startZoneOffset

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

title

Added in 1.1.0-beta02
val titleString?

Title of the session.