DataDeleteRequest | 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

# DataDeleteRequest

extends Object
implements Parcelable

java.lang.Object
↳ | com.google.android.gms.fitness.request.DataDeleteRequest

## Class Overview

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();

## Summary

Nested Classes
class | DataDeleteRequest.Builder | Builder used to create new DataDeleteRequests.

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final Creator<DataDeleteRequest> | CREATOR |

Public Methods
boolean | deleteAllData() Returns true if all data types are marked for deletion.
boolean | deleteAllSessions() Returns true if all sessions are marked for deletion.
int | describeContents()
boolean | equals(Object o)
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 | 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<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 int describeContents ()

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