public static class

Session.Builder

extends Object
java.lang.Object
   ↳ com.google.android.gms.fitness.data.Session.Builder

Class Overview

Builder used to create new Sessions.

Summary

Public Constructors
Session.Builder()
Constructs an instance of the Session.Builder.
Public Methods
Session build()
Finishes building and returns the session.
Session.Builder setActiveTime(long time, TimeUnit timeUnit)
Sets the active session period duration.
Session.Builder setActivity(String activity)
Sets the activity associated with this session.
Session.Builder setDescription(String description)
Sets a description for this session.
Session.Builder setEndTime(long time, TimeUnit timeUnit)
Sets the end time of the session.
Session.Builder setIdentifier(String identifier)
Sets the identifier for this session.
Session.Builder setName(String name)
Sets the a human readable name of the session.
Session.Builder setStartTime(long time, TimeUnit timeUnit)
Sets the start time of the session.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Session.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.

Returns
Session
Throws
IllegalStateException if the builder doesn't have enough state to create a valid request

public Session.Builder setActiveTime (long time, TimeUnit timeUnit)

Sets the active session period duration.

Parameters
time long
timeUnit TimeUnit
Returns
Session.Builder

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 UNKNOWN.

Parameters
activity String
Returns
Session.Builder

public Session.Builder setDescription (String description)

Sets a description for this session.

Parameters
description String
Returns
Session.Builder

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 long: an end time, in the given unit since epoch, inclusive
timeUnit TimeUnit: the unit of the timestamp
Returns
Session.Builder

public Session.Builder setIdentifier (String identifier)

Sets the identifier for this session. Must be unique for the client application.

Parameters
identifier String
Returns
Session.Builder

public Session.Builder setName (String name)

Sets the a human readable name of the session.

Parameters
name String
Returns
Session.Builder

public Session.Builder setStartTime (long time, TimeUnit timeUnit)

Sets the start time of the session.

Parameters
time long: a start time, in the given unit since epoch, inclusive
timeUnit TimeUnit: the unit of the timestamp
Returns
Session.Builder