Added in API level 34

Builder

class Builder
kotlin.Any
   ↳ android.health.connect.datatypes.SleepSessionRecord.Builder

Builder class for SleepSessionRecord

Summary

Public constructors
Builder(metadata: Metadata, startTime: Instant, endTime: Instant)

Public methods
SleepSessionRecord

Returns SleepSessionRecord

SleepSessionRecord.Builder

Sets the start zone offset of this record to system default.

SleepSessionRecord.Builder

Sets the start zone offset of this record to system default.

SleepSessionRecord.Builder
setEndZoneOffset(endZoneOffset: ZoneOffset)

Sets the zone offset of the user when the activity ended

SleepSessionRecord.Builder

Sets notes for this activity

SleepSessionRecord.Builder

Set stages to this sleep session.

SleepSessionRecord.Builder
setStartZoneOffset(startZoneOffset: ZoneOffset)

Sets the zone offset of the user when the activity started

SleepSessionRecord.Builder

Sets a title of this activity

Public constructors

Builder

Added in API level 34
Builder(
    metadata: Metadata,
    startTime: Instant,
    endTime: Instant)
Parameters
metadata Metadata: Metadata to be associated with the record. See Metadata. This value cannot be null.
startTime Instant: Start time of this sleep session This value cannot be null.
endTime Instant: End time of this sleep session This value cannot be null.

Public methods

build

Added in API level 34
fun build(): SleepSessionRecord

Returns SleepSessionRecord

Return
SleepSessionRecord This value cannot be null.

clearEndZoneOffset

Added in API level 34
fun clearEndZoneOffset(): SleepSessionRecord.Builder

Sets the start zone offset of this record to system default.

Return
SleepSessionRecord.Builder This value cannot be null.

clearStartZoneOffset

Added in API level 34
fun clearStartZoneOffset(): SleepSessionRecord.Builder

Sets the start zone offset of this record to system default.

Return
SleepSessionRecord.Builder This value cannot be null.

setEndZoneOffset

Added in API level 34
fun setEndZoneOffset(endZoneOffset: ZoneOffset): SleepSessionRecord.Builder

Sets the zone offset of the user when the activity ended

Parameters
endZoneOffset ZoneOffset: This value cannot be null.
Return
SleepSessionRecord.Builder This value cannot be null.

setNotes

Added in API level 34
fun setNotes(notes: CharSequence?): SleepSessionRecord.Builder

Sets notes for this activity

Parameters
notes CharSequence?: Additional notes for the session. Optional field. This value may be null.
Return
SleepSessionRecord.Builder This value cannot be null.

setStages

Added in API level 34
fun setStages(stages: MutableList<SleepSessionRecord.Stage!>): SleepSessionRecord.Builder

Set stages to this sleep session. Returns Object with updated stages.

Parameters
stages MutableList<SleepSessionRecord.Stage!>: list of stages to set This value cannot be null.
Return
SleepSessionRecord.Builder This value cannot be null.

setStartZoneOffset

Added in API level 34
fun setStartZoneOffset(startZoneOffset: ZoneOffset): SleepSessionRecord.Builder

Sets the zone offset of the user when the activity started

Parameters
startZoneOffset ZoneOffset: This value cannot be null.
Return
SleepSessionRecord.Builder This value cannot be null.

setTitle

Added in API level 34
fun setTitle(title: CharSequence?): SleepSessionRecord.Builder

Sets a title of this activity

Parameters
title CharSequence?: Title of the session. Optional field. This value may be null.
Return
SleepSessionRecord.Builder This value cannot be null.