# SexualActivityRecord

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/records/SexualActivityRecord.kt+class:androidx.health.connect.client.records.SexualActivityRecord) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
class SexualActivityRecord : Record
```

<br />

*** ** * ** ***

Captures an occurrence of sexual activity. Each record is a single occurrence. ProtectionUsed field is optional.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#PROTECTION_USED_PROTECTED() = 1` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#PROTECTION_USED_UNKNOWN() = 0` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#PROTECTION_USED_UNPROTECTED() = 2` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#SexualActivityRecord(java.time.Instant,java.time.ZoneOffset,androidx.health.connect.client.records.metadata.Metadata,kotlin.Int)( time: https://developer.android.com/reference/java/time/Instant.html, zoneOffset: https://developer.android.com/reference/java/time/ZoneOffset.html?, metadata: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata, protectionUsed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#toString()()` |

| ### Public properties |
|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#metadata()` Set of common metadata associated with the written record. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#protectionUsed()` Whether protection was used during sexual activity. |
| `open https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#time()` Time the record happened. |
| `open https://developer.android.com/reference/java/time/ZoneOffset.html?` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord#zoneOffset()` User experienced zone offset at `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/InstantaneousRecord#time()`, or null if unknown. |

## Constants

### PROTECTION_USED_PROTECTED

```
const val PROTECTION_USED_PROTECTED = 1: Int
```

### PROTECTION_USED_UNKNOWN

```
const val PROTECTION_USED_UNKNOWN = 0: Int
```

### PROTECTION_USED_UNPROTECTED

```
const val PROTECTION_USED_UNPROTECTED = 2: Int
```

## Public constructors

### SexualActivityRecord

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

```
SexualActivityRecord(
    time: Instant,
    zoneOffset: ZoneOffset?,
    metadata: Metadata,
    protectionUsed: Int = PROTECTION_USED_UNKNOWN
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### metadata

```
open val metadata: Metadata
```

Set of common metadata associated with the written record.

### protectionUsed

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

```
val protectionUsed: Int
```

Whether protection was used during sexual activity. Optional field, null if unknown. Allowed values: `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord.Protection`.

Value is one of the following:

- `1`
- `2`

<br />

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/SexualActivityRecord.Protection` |   |

### time

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

```
open val time: Instant
```

Time the record happened.

### zoneOffset

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

```
open val zoneOffset: ZoneOffset?
```

User experienced zone offset at `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/InstantaneousRecord#time()`, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.