Request for readingSession
data
from Google Fit. Use this request to specify the sessions to read, as well asdata sets
that should be read for each session.
Example usage for reading all sessions during a time interval, as well as step data points for each session:
new SessionReadRequest.Builder() .setTimeInterval(startTime.getMillis(), endTime.getMillis(), TimeUnit.MILLISECONDS) .read(DataType.TYPE_STEP_COUNT_DELTA) .build();
A valid time interval is mandatory for the request. Session name and identifier are optional fields that can be used to further filter out the returned result.
By default, only sessions created by the calling app will be returned. To get sessions
created by other apps, use
SessionReadRequest.Builder.readSessionsFromAllApps()
}
An app can only read public data types or custom data created by itself. Custom data types created by another app cannot be read.
Nested Class Summary
class | SessionReadRequest.Builder | Builder used to create a new SessionReadRequest. |
Inherited Constant Summary
Field Summary
public static finalCreator<SessionReadRequest> | CREATOR |
Public Method Summary
boolean | |
List<DataSource> |
getDataSources()
Returns the data sources to be read in this request.
|
List<DataType> |
getDataTypes()
Returns the data types for which default data sources should be read in this
request.
|
long | |
List<String> |
getExcludedPackages()
Returns any app package names that were excluded from the request.
|
String |
getSessionId()
Returns the session id we are requesting data for.
|
String |
getSessionName()
Returns the session name we are requesting data for.
|
long | |
int |
hashCode()
|
boolean |
includeSessionsFromAllApps()
Returns true if the read data should include sessions from other apps.
|
String |
toString()
|
void |
writeToParcel(Parceldest, int
flags)
|
Inherited Method Summary
Fields
public static finalCreator<SessionReadRequest> CREATOR
Public Methods
public booleanequals(Objecto)
publicList<DataSource> getDataSources()
Returns the data sources to be read in this request.
Returns
- The specified data sources, empty if none.
publicList<DataType> getDataTypes()
Returns the data types for which default data sources should be read in this request.
Returns
- The specified data types, empty if none.
public longgetEndTime(TimeUnit timeUnit)
Returns the end time for our query, in the given time unit
publicList<String> getExcludedPackages()
Returns any app package names that were excluded from the request.
Returns
- The list of excluded packages, empty if none.
publicStringgetSessionId()
Returns the session id we are requesting data for.
Returns
- The specified session identifier, or
null
if unspecified.
publicStringgetSessionName()
Returns the session name we are requesting data for.
Returns
- The specified session name, or
null
if unspecified.
public longgetStartTime(TimeUnit timeUnit)
Returns the start time for our query, in the given time unit
public inthashCode()
public booleanincludeSessionsFromAllApps()
Returns true if the read data should include sessions from other apps.