SessionInsertRequest | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Nested Classes | Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
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
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

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
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## 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)