public class

SessionInsertRequest

extends Object
implements Parcelable
java.lang.Object
   ↳ com.google.android.gms.fitness.request.SessionInsertRequest

Class Overview

A request for inserting a Session and associated DataSet and/or aggregated DataPoint into the Google Fit store. Useful when data is read from a data source outside of Google Fit, or when inserting batch historical data.

The request cannot have a continuing session, i.e. session should have valid start and end times. Request may contain multiple data sets and multiple aggregated data points.

The Builder will enforce that each data set or aggregated data point represents a unique DataSource. The Builder will also enforce that timestamps of the data specified are consistent with session start and end times. For all data points specified in the data set(s), the timestamps should fall between the session start and end times. And for all aggregate data points, the start and end time timestamps should fall between the session start and end times.

Example usage:

     Session session = new Session.Builder()
          .setName(sessionName)
          .setIdentifier(identifier)
          .setDescription(description)
          .setStartTime(startTime.getMillis(), TimeUnit.MILLISECONDS)
          .setEndTime(endTime.getMillis(), TimeUnit.MILLISECONDS)
          .build();
     SessionInsertRequest request = new SessionInsertRequest.Builder()
          .setSession(session)
          .addDataSet(dataSet)
          .addAggregatedDataPoint(dataPoint)
          .build();
 
Apps can only add data for public data types or custom data types created by itself. Data of custom data type created by another app cannot be added.

Summary

Nested Classes
class SessionInsertRequest.Builder Builder used to create new SessionInsertRequest. 
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<SessionInsertRequest> CREATOR
Public Methods
int describeContents()
boolean equals(Object o)
List<DataPoint> getAggregateDataPoints()
Returns the aggregate data points we are inserting.
List<DataSet> getDataSets()
Returns the data sets we are inserting.
Session getSession()
Returns the session we are inserting.
int hashCode()
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<SessionInsertRequest> CREATOR

Public Methods

public int describeContents ()

public boolean equals (Object o)

public List<DataPoint> getAggregateDataPoints ()

Returns the aggregate data points we are inserting.

Returns
  • the list of specified data points, empty if none

public List<DataSet> getDataSets ()

Returns the data sets we are inserting.

Returns
  • the list of specified data sets, empty if none

public Session getSession ()

Returns the session we are inserting.

public int hashCode ()

public String toString ()

public void writeToParcel (Parcel dest, int flags)