Class Info |
|---|
public class DeleteOptions Request parameter class for deleting data and activity records within a specified period of time from Health Service Kit. An app can delete only the data and activity records added by itself. |
When constructing a DeleteOptions object to delete data, you must specify the time range for the data deletion, and specify a DataType or multiple DataCollector objects as needed. You can also choose to delete all data. If none is specified, no data of the app will be deleted.
The sample code is as follows:
Java
DeleteOptions deleteOptions = new DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addDataType(DataType.DT_CONTINUOUS_STEPS_DELTA)
.build(); Kotlin
val deleteOptions = DeleteOptions.Builder()
.addDataType(DataType.DT_CONTINUOUS_STEPS_DELTA)
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.build() Java
DeleteOptions deleteOptions = new DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addDataType(DataType.DT_CONTINUOUS_STEPS_DELTA)
.addDataType(DataType.DT_INSTANTANEOUS_HEIGHT)
.build(); Kotlin
val deleteOptions = DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addDataType(DataType.DT_CONTINUOUS_STEPS_DELTA)
.addDataType(DataType.DT_INSTANTANEOUS_HEIGHT)
.build() Java
DeleteOptions deleteOptions = new DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addDataType(DataType.DT_CONTINUOUS_STEPS_DELTA)
.addDataCollector(dataCollector1)
.addDataCollector(dataCollector2)
.build(); Kotlin
val deleteOptions = DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addDataType(DataType.DT_CONTINUOUS_STEPS_DELTA)
.addDataCollector(dataCollector1)
.addDataCollector(dataCollector2)
.build() Java
DeleteOptions deleteOptions = new DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.deleteAllData()
.build(); Kotlin
val deleteOptions = DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.deleteAllData()
.build() When constructing a DeleteOptions object to delete activity records, you must specify the time range for the activity records to be deleted. You can also specify one or more ActivityRecord objects as needed, or choose to delete all ActivityRecords. If not specified, no activity record will be deleted.
The sample code for constructing a DeleteOptions object to delete activity records is as follows:
Java
DeleteOptions deleteOptions = new DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addActivityRecord(activityRecordRunning)
.addActivityRecord(activityRecordSwimming)
.build(); Kotlin
val deleteOptions = DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.addActivityRecord(activityRecordRunning)
.addActivityRecord(activityRecordSwimming)
.build() Java
DeleteOptions deleteOptions = new DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.deleteAllActivityRecords()
.build(); Kotlin
val deleteOptions = DeleteOptions.Builder()
.setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
.deleteAllActivityRecords()
.build() Qualifier and Type | Class Name and Description |
|---|---|
public static class | Builder for DeleteOptions. |
Qualifier and Type | Method Name and Description |
|---|---|
boolean | Indicates whether to delete all activity records. |
boolean | Indicates whether to delete all data. |
List<ActivityRecord> | Obtains the activity records to be deleted. |
List<DataCollector> | Obtains the list of data collectors whose data is to be deleted. |
List<DataType> | Obtains the types of data to be deleted. |
long | getEndTime(TimeUnit timeUnit) Obtains the end time of the data range to be deleted. |
long | getStartTime(TimeUnit timeUnit) Obtains the start time of the data range to be deleted. |
Method |
|---|
public boolean deleteAllActivityRecords() Indicates whether to delete all activity records. |
Returns
Type | Description |
|---|---|
boolean | Whether all activity records are deleted:
|
Method |
|---|
public boolean deleteAllData() Indicates whether to delete all data. |
Returns
Type | Description |
|---|---|
boolean | Whether all data is deleted:
|
Method |
|---|
public List<ActivityRecord> getActivityRecords() Obtains the activity records to be deleted. |
Returns
Type | Description |
|---|---|
List<ActivityRecord> | List of activity records to be deleted. If none has been specified, the list is empty. |
Method |
|---|
public List<DataCollector> getDataCollectors() Obtains the list of data collectors whose data is to be deleted. |
Returns
Type | Description |
|---|---|
List<DataCollector> | List of data collectors whose data is to be deleted. If none has been specified, the list is empty. |
Method |
|---|
public List<DataType> getDataTypes() Obtains the types of data to be deleted. |
Returns
Type | Description |
|---|---|
List<DataType> | List of data types whose data is to be deleted. If none has been specified, the list is empty. |