androidx.health.connect.client
Interfaces
HealthConnectClient |
Interface to access health and fitness records. |
HealthConnectFeatures |
Interface for checking availability of features in |
PermissionController |
Interface for operations related to permissions. |
Annotations
ExperimentalMatchmakingApi |
Marker for experimental Matchmaking APIs. |
Extension functions summary
suspend inline Unit |
<T : Record> HealthConnectClient.deleteRecords(Deletes any |
suspend inline Unit |
<T : Record> HealthConnectClient.deleteRecords(Deletes one or more |
suspend inline ReadRecordResponse<T> |
<T : Record> HealthConnectClient.readRecord(recordId: String)Reads one |
Extension functions
HealthConnectClient.deleteRecords
suspend inline fun <T : Record> HealthConnectClient.deleteRecords(
timeRangeFilter: TimeRangeFilter
): Unit
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 : Record> |
Which type of |
timeRangeFilter: TimeRangeFilter |
The |
| Throws | |
|---|---|
RemoteException |
For any IPC transportation failures. |
SecurityException |
For requests with unpermitted access. |
IOException |
For any disk I/O issues. |
IllegalStateException |
If service is not available. |
| See also | |
|---|---|
deleteRecords |
Example usage to delete written steps data in a time range: |
HealthConnectClient.deleteRecords
suspend inline fun <T : Record> HealthConnectClient.deleteRecords(
recordIdsList: List<String>,
clientRecordIdsList: List<String>
): Unit
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 : Record> |
Which type of |
recordIdsList: List<String> |
List of |
clientRecordIdsList: List<String> |
List of client record IDs of |
| Throws | |
|---|---|
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. |
SecurityException |
For requests with unpermitted access. |
IOException |
For any disk I/O issues. |
IllegalStateException |
If service is not available. |
| See also | |
|---|---|
deleteRecords |
Example usage to delete written steps data by its unique identifier: |
HealthConnectClient.readRecord
suspend inline fun <T : Record> HealthConnectClient.readRecord(recordId: String): ReadRecordResponse<T>
Reads one Record point of type T and with the specified recordId.
| Parameters | |
|---|---|
<T : Record> |
Which type of |
recordId: String |
|
| Returns | |
|---|---|
ReadRecordResponse<T> |
The |
| Throws | |
|---|---|
RemoteException |
For any IPC transportation failures. Update with invalid identifiers will result in IPC failure. |
SecurityException |
For requests with unpermitted access. |
IOException |
For any disk I/O issues. |
IllegalStateException |
If service is not available. |
| See also | |
|---|---|
readRecord |