A request to delete data and sessions added by the app from the Google Fit store in the time interval specified.
An app can either specify a specificDataType
or
a specificDataSource
or mark data for all data types to be deleted. If neither a specific data type/source is
specified nor all data is marked for deletion, then no data will be deleted.
An app can also request to delete specificSessions
or
all sessions added by this app. If neither a specific session is specified nor all sessions
are marked for deletion, then no session will be deleted.
Only sessions that have already ended can be specified. Ongoing sessions will not be deleted.
An app can only delete data and sessions that it has added and cannot delete data and sessions added by other apps.
Sample usage to delete data for a specific data type and session:
DataDeleteRequest request = new DataDeleteRequest.Builder() .setTimeInterval(startTime, endTime, timeUnit) .addDataType(dataType) .addSession(session) .build();
DataDeleteRequest request = new DataDeleteRequest.Builder() .setTimeInterval(startTime, endTime, timeUnit) .deleteAllData() .addSession(session) .build();
DataDeleteRequest request = new DataDeleteRequest.Builder() .setTimeInterval(startTime, endTime, timeUnit) .deleteAllData() .deleteAllSessions() .build();
Nested Class Summary
class | DataDeleteRequest.Builder | Builder used to create new DataDeleteRequests. |
Inherited Constant Summary
Field Summary
public static finalCreator<DataDeleteRequest> | CREATOR |
Public Method Summary
boolean |
deleteAllData()
Returns true if all data types are marked for deletion.
|
boolean |
deleteAllSessions()
Returns true if all sessions are marked for deletion.
|
boolean | |
List<DataSource> |
getDataSources()
Returns the list of data sources specified for data deletion.
|
List<DataType> |
getDataTypes()
Returns the list of data types specified for data deletion.
|
long | |
List<Session> |
getSessions()
Returns the list of sessions specified for deletion.
|
long | |
int |
hashCode()
|
String |
toString()
|
void |
writeToParcel(Parceldest, int
flags)
|
Inherited Method Summary
Fields
public static finalCreator<DataDeleteRequest> CREATOR
Public Methods
public booleandeleteAllData()
Returns true if all data types are marked for deletion. Otherwise, only the
specified
data types
and
data sources
will have their data deleted.
public booleandeleteAllSessions()
Returns true if all sessions are marked for deletion. Otherwise, only the specified
sessions
will be deleted.
public booleanequals(Objecto)
publicList<DataSource> getDataSources()
Returns the list of data sources specified for data deletion.
Returns
- The data sources to have their data deleted, empty if none.
publicList<DataType> getDataTypes()
Returns the list of data types specified for data deletion. All data sources for the given data type will be deleted.
Returns
- The data types to have their data deleted, empty if none.
public longgetEndTime(TimeUnit timeUnit)
Returns the end time of the query, in the given unit since epoch. A valid end time is always set.
publicList<Session> getSessions()
Returns the list of sessions specified for deletion.
Returns
- The sessions that will be deleted, empty if none.
public longgetStartTime(TimeUnit timeUnit)
Returns the start time of the query, in the given unit since epoch. A valid start time is always set.