SleepSessionRecord.Builder

public static final class SleepSessionRecord.Builder
extends Object

java.lang.Object
   ↳ android.health.connect.datatypes.SleepSessionRecord.Builder


Builder class for SleepSessionRecord

Summary

Public constructors

Builder(Metadata metadata, Instant startTime, Instant endTime)

Public methods

SleepSessionRecord build()

Returns SleepSessionRecord

SleepSessionRecord.Builder clearEndZoneOffset()

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

SleepSessionRecord.Builder clearStartZoneOffset()

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

SleepSessionRecord.Builder setEndZoneOffset(ZoneOffset endZoneOffset)

Sets the zone offset of the user when the activity ended

SleepSessionRecord.Builder setNotes(CharSequence notes)

Sets notes for this activity

SleepSessionRecord.Builder setStages(List<SleepSessionRecord.Stage> stages)

Set stages to this sleep session.

SleepSessionRecord.Builder setStartZoneOffset(ZoneOffset startZoneOffset)

Sets the zone offset of the user when the activity started

SleepSessionRecord.Builder setTitle(CharSequence title)

Sets a title of this activity

Inherited methods

Public constructors

Builder

Added in API level 34
public Builder (Metadata metadata, 
                Instant startTime, 
                Instant endTime)

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
public SleepSessionRecord build ()

Returns SleepSessionRecord

Returns
SleepSessionRecord This value cannot be null.

clearEndZoneOffset

Added in API level 34
public SleepSessionRecord.Builder clearEndZoneOffset ()

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

Returns
SleepSessionRecord.Builder This value cannot be null.

clearStartZoneOffset

Added in API level 34
public SleepSessionRecord.Builder clearStartZoneOffset ()

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

Returns
SleepSessionRecord.Builder This value cannot be null.

setEndZoneOffset

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

Sets the zone offset of the user when the activity ended

Parameters
endZoneOffset ZoneOffset: This value cannot be null.

Returns
SleepSessionRecord.Builder This value cannot be null.

setNotes

Added in API level 34
public SleepSessionRecord.Builder setNotes (CharSequence notes)

Sets notes for this activity

Parameters
notes CharSequence: Additional notes for the session. Optional field. This value may be null.

Returns
SleepSessionRecord.Builder This value cannot be null.

setStages

Added in API level 34
public SleepSessionRecord.Builder setStages (List<SleepSessionRecord.Stage> stages)

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

Parameters
stages List: list of stages to set This value cannot be null.

Returns
SleepSessionRecord.Builder This value cannot be null.

setStartZoneOffset

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

Sets the zone offset of the user when the activity started

Parameters
startZoneOffset ZoneOffset: This value cannot be null.

Returns
SleepSessionRecord.Builder This value cannot be null.

setTitle

Added in API level 34
public SleepSessionRecord.Builder setTitle (CharSequence title)

Sets a title of this activity

Parameters
title CharSequence: Title of the session. Optional field. This value may be null.

Returns
SleepSessionRecord.Builder This value cannot be null.