AI-generated Key Takeaways
-
Session.Builder is used to create new Sessions.
-
You can set various properties of a session using the builder, such as active time, activity, description, end time, identifier, name, and start time.
-
The build() method finishes building and returns the session.
-
Sessions created with the builder will always have a non-empty non-null identifier.
Builder used to create new Sessions.
Public Constructor Summary
Public Method Summary
| Session | |
| Session.Builder | |
| Session.Builder | |
| Session.Builder | |
| Session.Builder | |
| Session.Builder | |
| Session.Builder | |
| Session.Builder |
Inherited Method Summary
Public Constructors
public Builder ()
Constructs an instance of the Session.Builder
.
Public Methods
public Session build ()
Finishes building and returns the session. Returned session will always have non-empty non-null identifier.
Throws
public Session.Builder setActiveTime (long time, TimeUnit timeUnit)
Sets the active session period duration.
public Session.Builder setActivity ( String activity)
Sets the activity associated with this session. The specified activity value should
be one of the values in FitnessActivities
.
If an unrecognized value is specified, or if not specified, the activity for the
session is set to FitnessActivities.UNKNOWN
.
public Session.Builder setDescription ( String description)
Sets a description for this session.
public Session.Builder setEndTime (long time, TimeUnit timeUnit)
Sets the end time of the session. If end time is not specified, session is considered to be still ongoing.
Parameters
| time | An end time, in the given unit since epoch, inclusive. |
|---|---|
| timeUnit | The unit of the timestamp. |
public Session.Builder setIdentifier ( String identifier)
Sets the identifier for this session. Must be unique for the client application.
public Session.Builder setName ( String name)
Sets the a human readable name of the session.
public Session.Builder setStartTime (long time, TimeUnit timeUnit)
Sets the start time of the session.
Parameters
| time | A start time, in the given unit since epoch, inclusive. |
|---|---|
| timeUnit | The unit of the timestamp. |

