DataDeleteRequest

public class DataDeleteRequest extends Object
implements Parcelable

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 specific DataType or a specific DataSource 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 specific Sessions 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();
 
Sample usage to delete data for all data types and a specific session:
     DataDeleteRequest request = new DataDeleteRequest.Builder()
          .setTimeInterval(startTime, endTime, timeUnit)
          .deleteAllData()
          .addSession(session)
          .build();
 
Sample usage to delete data for all data types and all sessions:
     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 final Creator<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
getEndTime(TimeUnit timeUnit)
Returns the end time of the query, in the given unit since epoch.
List<Session>
getSessions()
Returns the list of sessions specified for deletion.
long
getStartTime(TimeUnit timeUnit)
Returns the start time of the query, in the given unit since epoch.
int
String
void
writeToParcel(Parcel dest, int flags)

Inherited Method Summary

Fields

public static final Creator<DataDeleteRequest> CREATOR

Public Methods

public boolean deleteAllData ()

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 boolean deleteAllSessions ()

Returns true if all sessions are marked for deletion. Otherwise, only the specified sessions will be deleted.

public boolean equals (Object o)

public List<DataSource> getDataSources ()

Returns the list of data sources specified for data deletion.

Returns
  • the data sources to have their data deleted, empty if none

public List<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 long getEndTime (TimeUnit timeUnit)

Returns the end time of the query, in the given unit since epoch. A valid end time is always set.

public List<Session> getSessions ()

Returns the list of sessions specified for deletion.

Returns
  • the sessions that will be deleted, empty if none

public long getStartTime (TimeUnit timeUnit)

Returns the start time of the query, in the given unit since epoch. A valid start time is always set.

public int hashCode ()

public String toString ()

public void writeToParcel (Parcel dest, int flags)