HealthConnectClientExt
public final class HealthConnectClientExt
Summary
Public methods |
|
|---|---|
static final void |
<T extends Record> deleteRecords(Deletes any |
static final void |
<T extends Record> deleteRecords(Deletes one or more |
static final @NonNull ReadRecordResponse<@NonNull T> |
<T extends Record> readRecord(Reads one |
Public methods
deleteRecords
public static final void <T extends Record> deleteRecords(
@NonNull HealthConnectClient receiver,
@NonNull TimeRangeFilter timeRangeFilter
)
Deletes any Record of type T in the given timeRangeFilter (automatically filtered to Record belonging to the calling application). Deletion of multiple Record is executed in a transaction - if one fails, none is deleted.
import androidx.health.connect.client.deleteRecords import androidx.health.connect.client.records.StepsRecord import androidx.health.connect.client.time.TimeRangeFilter healthConnectClient.deleteRecords<StepsRecord>( timeRangeFilter = TimeRangeFilter.between(startTime, endTime) )
| Parameters | |
|---|---|
<T extends Record> |
Which type of |
@NonNull TimeRangeFilter timeRangeFilter |
The |
| Throws | |
|---|---|
android.os.RemoteException |
For any IPC transportation failures. |
java.lang.SecurityException |
For requests with unpermitted access. |
java.io.IOException |
For any disk I/O issues. |
kotlin.IllegalStateException |
If service is not available. |
| See also | |
|---|---|
deleteRecords |
Example usage to delete written steps data in a time range: |
deleteRecords
public static final void <T extends Record> deleteRecords(
@NonNull HealthConnectClient receiver,
@NonNull List<@NonNull String> recordIdsList,
@NonNull List<@NonNull String> clientRecordIdsList
)
Deletes one or more Record by their identifiers. Deletion of multiple Record is executed in single transaction - if one fails, none is deleted.
import androidx.health.connect.client.deleteRecords import androidx.health.connect.client.records.StepsRecord healthConnectClient.deleteRecords<StepsRecord>( recordIdsList = listOf(uid1, uid2), clientRecordIdsList = emptyList(), )
| Parameters | |
|---|---|
<T extends Record> |
Which type of |
@NonNull List<@NonNull String> recordIdsList |
List of |
@NonNull List<@NonNull String> clientRecordIdsList |
List of client record IDs of |
| Throws | |
|---|---|
android.os.RemoteException |
For any IPC transportation failures. Deleting by invalid identifiers such as a non-existing identifier or deleting the same record multiple times will result in IPC failure. |
java.lang.SecurityException |
For requests with unpermitted access. |
java.io.IOException |
For any disk I/O issues. |
kotlin.IllegalStateException |
If service is not available. |
| See also | |
|---|---|
deleteRecords |
Example usage to delete written steps data by its unique identifier: |
readRecord
public static final @NonNull ReadRecordResponse<@NonNull T> <T extends Record> readRecord(
@NonNull HealthConnectClient receiver,
@NonNull String recordId
)
Reads one Record point of type T and with the specified recordId.
| Parameters | |
|---|---|
<T extends Record> |
Which type of |
@NonNull String recordId |
|
| Returns | |
|---|---|
@NonNull ReadRecordResponse<@NonNull T> |
The |
| Throws | |
|---|---|
android.os.RemoteException |
For any IPC transportation failures. Update with invalid identifiers will result in IPC failure. |
java.lang.SecurityException |
For requests with unpermitted access. |
java.io.IOException |
For any disk I/O issues. |
kotlin.IllegalStateException |
If service is not available. |
| See also | |
|---|---|
readRecord |