# HealthPermission

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/permission/HealthPermission.kt+class:androidx.health.connect.client.permission.HealthPermission) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
public final class HealthPermission
```

<br />

*** ** * ** ***

A Permission either to read or write data associated with a `https://developer.android.com/reference/androidx/health/connect/client/records/Record` type.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/health/connect/client/PermissionController` |   |

## Summary

| ### Constants |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_EXERCISE_ROUTES()` A permission to read exercise routes. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_HEALTH_DATA_HISTORY()` A permission that allows to read the entire history of health data (of any type). |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND()` A permission to read data in background. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_ALLERGIES_INTOLERANCES()` Allows an application to read the user's data about allergies and intolerances. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_CONDITIONS()` Allows an application to read the user's data about medical conditions. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_LABORATORY_RESULTS()` Allows an application to read the user's laboratory result data. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_MEDICATIONS()` Allows an application to read the user's medication data. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_PERSONAL_DETAILS()` Allows an application to read the user's personal details. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_PRACTITIONER_DETAILS()` Allows an application to read the user's data about the practitioners who have interacted with them in their medical record. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_PREGNANCY()` Allows an application to read the user's pregnancy data. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_PROCEDURES()` Allows an application to read the user's data about medical procedures. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_SOCIAL_HISTORY()` Allows an application to read the user's social history data. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_VACCINES()` Allows an application to read the user's data about immunizations and vaccinations. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_VISITS()` Allows an application to read the user's information about their encounters with health care practitioners, including things like location, time of appointment, and name of organization the visit was with. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_VITAL_SIGNS()` Allows an application to read the user's vital signs data. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_WRITE_EXERCISE_ROUTE()` A permission to write exercise routes. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/health/connect/client/feature/ExperimentalPersonalHealthRecordApi https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_WRITE_MEDICAL_DATA()` Permission to write medical data records. |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `<T extends https://developer.android.com/reference/androidx/health/connect/client/records/Record> https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#getReadPermission()()` Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to read records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getReadPermission()`, such as `StepsRecord`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#getReadPermission(kotlin.reflect.KClass)(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/Record> recordType)` Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to read records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getReadPermission(kotlin.reflect.KClass)`, such as `StepsRecord::class`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `<T extends https://developer.android.com/reference/androidx/health/connect/client/records/Record> https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#getWritePermission()()` Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to write records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getWritePermission()`, such as `StepsRecord:`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#getWritePermission(kotlin.reflect.KClass)(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/Record> recordType)` Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to write records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getWritePermission(kotlin.reflect.KClass)`, such as `StepsRecord::class`. |

## Constants

### PERMISSION_READ_EXERCISE_ROUTES

```
public static final @NonNull String PERMISSION_READ_EXERCISE_ROUTES
```

A permission to read exercise routes. The string value for this permission is `android.permission.health.READ_EXERCISE_ROUTES`.

This permission can't be granted via the standard permission request mechanism, and can only be granted by a user in Settings, or via the dialog launched by `https://developer.android.com/reference/androidx/health/connect/client/contracts/ExerciseRouteRequestContract`.

When this permission is granted, the app can read exercise routes without user interaction, however reading apps must be in the foreground unless `android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND` is also granted.

When this permission is revoked, exercise routes can only be obtained by launching the `https://developer.android.com/reference/androidx/health/connect/client/contracts/ExerciseRouteRequestContract` intent.

```kotlin
import androidx.health.connect.client.contracts.ExerciseRouteRequestContract
import androidx.health.connect.client.readRecord
import androidx.health.connect.client.records.ExerciseRoute
import androidx.health.connect.client.records.ExerciseRouteResult
import androidx.health.connect.client.records.ExerciseSessionRecord

// See https://developer.android.com/training/basics/intents/result#launch for appropriately
// handling ActivityResultContract.
val requestExerciseRoute =
    activityResultCaller.registerForActivityResult(ExerciseRouteRequestContract()) {
        exerciseRoute: ExerciseRoute? ->
        if (exerciseRoute != null) {
            displayExerciseRoute(exerciseRoute)
        } else {
            // Consent was denied
        }
    }

// Show exercise route, based on user action
val exerciseSessionRecord =
    healthConnectClient.readRecord<ExerciseSessionRecord>(recordId).record

when (val exerciseRouteResult = exerciseSessionRecord.exerciseRouteResult) {
    is ExerciseRouteResult.Data -> displayExerciseRoute(exerciseRouteResult.exerciseRoute)
    is ExerciseRouteResult.ConsentRequired -> requestExerciseRoute.launch(recordId)
    is ExerciseRouteResult.NoData -> Unit // No exercise route to show
    else -> Unit
}
```

### PERMISSION_READ_HEALTH_DATA_HISTORY

```
public static final @NonNull String PERMISSION_READ_HEALTH_DATA_HISTORY
```

A permission that allows to read the entire history of health data (of any type).

Without this permission:

1. Any attempt to read a single data point, via `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#readRecord(kotlin.reflect.KClass,kotlin.String)`, older than 30 days from before the first HealthConnect permission was granted to the calling app, will result in an error.

2. Any other read attempts will not return data points older than 30 days from before the first HealthConnect permission was granted to the calling app.

This permission applies for the following api methods: `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#readRecord(kotlin.reflect.KClass,kotlin.String)`, `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#readRecords(androidx.health.connect.client.request.ReadRecordsRequest)`, `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#aggregate(androidx.health.connect.client.request.AggregateRequest)`, `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#aggregateGroupByPeriod(androidx.health.connect.client.request.AggregateGroupByPeriodRequest)`, `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#aggregateGroupByDuration(androidx.health.connect.client.request.AggregateGroupByDurationRequest)` and `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectClient#getChanges(kotlin.String)`.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_READ_HEALTH_DATA_HISTORY()` as an argument.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_HEALTH_DATA_HISTORY

val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (PERMISSION_READ_HEALTH_DATA_HISTORY in grantedPermissions) {
            // It will be possible to read data older than 30 days from now on
        } else {
            // Permission denied, it won't be possible to read data older than 30 days
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_READ_HEALTH_DATA_HISTORY) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request history read permissions
    requestPermission.launch(setOf(PERMISSION_READ_HEALTH_DATA_HISTORY))
}
```

### PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND

```
public static final @NonNull String PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND
```

A permission to read data in background.

An attempt to read data in background without this permission may result in an error.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_READ_HEALTH_DATA_IN_BACKGROUND()` as an argument.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND

val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND in grantedPermissions) {
            // It will be possible to read data in background from now on
        } else {
            // Permission denied, it won't be possible to read data in background
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_READ_HEALTH_DATA_IN_BACKGROUND) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request background reads permission
    requestPermission.launch(setOf(PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND))
}
```

```kotlin
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND
import androidx.health.connect.client.readRecord
import androidx.health.connect.client.records.StepsRecord
import androidx.health.connect.client.request.ReadRecordsRequest
import androidx.health.connect.client.time.TimeRangeFilter

val grantedPermissions = healthConnectClient.permissionController.getGrantedPermissions()

// The permission should be requested and granted beforehand when the app is in foreground
if (PERMISSION_READ_HEALTH_DATA_IN_BACKGROUND !in grantedPermissions) {
    return
}

val response =
    healthConnectClient.readRecords(
        ReadRecordsRequest<StepsRecord>(
            timeRangeFilter = TimeRangeFilter.between(startTime, endTime)
        )
    )

for (stepsRecord in response.records) {
    // Process each record
}
```

### PERMISSION_READ_MEDICAL_DATA_ALLERGIES_INTOLERANCES

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_ALLERGIES_INTOLERANCES
```

Allows an application to read the user's data about allergies and intolerances.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_CONDITIONS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_CONDITIONS
```

Allows an application to read the user's data about medical conditions.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_LABORATORY_RESULTS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_LABORATORY_RESULTS
```

Allows an application to read the user's laboratory result data.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_MEDICATIONS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_MEDICATIONS
```

Allows an application to read the user's medication data.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_PERSONAL_DETAILS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_PERSONAL_DETAILS
```

Allows an application to read the user's personal details.

This is demographic information such as name, date of birth, contact details like address or telephone number and so on. For more examples see the FHIR Patient resource at https://www.hl7.org/fhir/patient.html.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_PRACTITIONER_DETAILS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_PRACTITIONER_DETAILS
```

Allows an application to read the user's data about the practitioners who have interacted with them in their medical record. This is the information about the clinicians (doctors, nurses, etc) but also other practitioners (masseurs, physiotherapists, etc) who have been involved with the patient.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_PREGNANCY

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_PREGNANCY
```

Allows an application to read the user's pregnancy data.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_PROCEDURES

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_PROCEDURES
```

Allows an application to read the user's data about medical procedures.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_SOCIAL_HISTORY

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_SOCIAL_HISTORY
```

Allows an application to read the user's social history data.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_VACCINES

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_VACCINES
```

Allows an application to read the user's data about immunizations and vaccinations.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_VISITS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_VISITS
```

Allows an application to read the user's information about their encounters with health care practitioners, including things like location, time of appointment, and name of organization the visit was with. Despite the name visit it covers remote encounters such as telephone or videoconference appointments.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_READ_MEDICAL_DATA_VITAL_SIGNS

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_READ_MEDICAL_DATA_VITAL_SIGNS
```

Allows an application to read the user's vital signs data.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

### PERMISSION_WRITE_EXERCISE_ROUTE

```
public static final @NonNull String PERMISSION_WRITE_EXERCISE_ROUTE
```

A permission to write exercise routes.

This permission must be granted to successfully insert a route as a field of the corresponding `https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseSessionRecord`. An attempt to insert/update a session with a set route without the permission granted will result in a failed call and the session insertion/update will be rejected.

If the permission is not granted the previously written route will not be deleted if the session gets updated with no route set.

```kotlin
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_EXERCISE_ROUTE
import androidx.health.connect.client.permission.HealthPermission.Companion.getWritePermission
import androidx.health.connect.client.records.ExerciseRoute
import androidx.health.connect.client.records.ExerciseSessionRecord
import androidx.health.connect.client.records.metadata.Metadata
import androidx.health.connect.client.units.Length

val grantedPermissions = healthConnectClient.permissionController.getGrantedPermissions()

if (!grantedPermissions.contains(getWritePermission(ExerciseSessionRecord::class))) {
    return
}

val sessionStartTime = Instant.parse("2023-07-11T10:00:00.00Z")
val sessionDuration = Duration.ofMinutes(10)

val startLatitude = 51.511831
val endLatitude = 51.506007
val startLongitude = -0.165785
val endLongitude = -0.164888
val latitudeDeltaPerSecond = (endLatitude - startLatitude) / sessionDuration.seconds
val longitudeDeltaPerSecond = (endLongitude - startLongitude) / sessionDuration.seconds

val exerciseRoute =
    if (grantedPermissions.contains(PERMISSION_WRITE_EXERCISE_ROUTE)) {
        ExerciseRoute(
            List(sessionDuration.seconds.toInt()) { timeSeconds ->
                ExerciseRoute.Location(
                    time = sessionStartTime.plusSeconds(timeSeconds.toLong()),
                    latitude = startLatitude + latitudeDeltaPerSecond * timeSeconds,
                    longitude = startLongitude + longitudeDeltaPerSecond * timeSeconds,
                    horizontalAccuracy = Length.meters(2.0),
                    verticalAccuracy = Length.meters(2.0),
                    altitude = Length.meters(19.0),
                )
            }
        )
    } else {
        null
    }

val exerciseSessionRecord =
    ExerciseSessionRecord(
        startTime = sessionStartTime,
        startZoneOffset = ZoneOffset.UTC,
        endTime = sessionStartTime.plus(sessionDuration),
        endZoneOffset = ZoneOffset.UTC,
        metadata = Metadata.manualEntry(),
        exerciseType = ExerciseSessionRecord.EXERCISE_TYPE_RUNNING,
        title = "Morning Run",
        notes = "A nice run in a park",
        exerciseRoute = exerciseRoute,
    )

healthConnectClient.insertRecords(listOf(exerciseSessionRecord))
```

### PERMISSION_WRITE_MEDICAL_DATA

```
@ExperimentalPersonalHealthRecordApi
public static final @NonNull String PERMISSION_WRITE_MEDICAL_DATA
```

Permission to write medical data records. This permission allows for the write of medical data of any type. Note that read permissions are specified per-type.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. If not available, this permission will not be granted if requested.

```kotlin
import androidx.health.connect.client.HealthConnectFeatures
import androidx.health.connect.client.PermissionController
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_READ_MEDICAL_DATA_VACCINES
import androidx.health.connect.client.permission.HealthPermission.Companion.PERMISSION_WRITE_MEDICAL_DATA

// The set of medical permissions to be requested (add additional read permissions as required)
val medicalPermissions =
    setOf(PERMISSION_WRITE_MEDICAL_DATA, PERMISSION_READ_MEDICAL_DATA_VACCINES)
val requestPermission =
    activity.registerForActivityResult(
        PermissionController.createRequestPermissionResultContract()
    ) { grantedPermissions: Set<String> ->
        if (grantedPermissions.containsAll(medicalPermissions)) {
            // Permissions granted to write health data and read immunizations
        } else {
            // User denied permission to write health data and/or read immunizations
        }
    }

if (
    features.getFeatureStatus(HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD) ==
        HealthConnectFeatures.FEATURE_STATUS_AVAILABLE
) {
    // The feature is available, request medical permissions
    requestPermission.launch(medicalPermissions)
}
```

## Public methods

### getReadPermission

```
public static final @NonNull String <T extends Record> getReadPermission()
```

Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to read records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getReadPermission()`, such as `StepsRecord`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | Permission to use with `https://developer.android.com/reference/androidx/health/connect/client/PermissionController`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the given record type is invalid. |

### getReadPermission

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public static final @NonNull String getReadPermission(@NonNull KClass<@NonNull Record> recordType)
```

Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to read records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getReadPermission(kotlin.reflect.KClass)`, such as `StepsRecord::class`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | Permission to use with `https://developer.android.com/reference/androidx/health/connect/client/PermissionController`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the given record type is invalid. |

### getWritePermission

```
public static final @NonNull String <T extends Record> getWritePermission()
```

Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to write records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getWritePermission()`, such as `StepsRecord:`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | Permission object to use with `https://developer.android.com/reference/androidx/health/connect/client/PermissionController`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the given record type is invalid. |

### getWritePermission

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public static final @NonNull String getWritePermission(@NonNull KClass<@NonNull Record> recordType)
```

Returns a permission defined in `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission` to write records of type `https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission.Companion#getWritePermission(kotlin.reflect.KClass)`, such as `StepsRecord::class`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | Permission object to use with `https://developer.android.com/reference/androidx/health/connect/client/PermissionController`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the given record type is invalid. |