# RetryPolicy.RetryConfig

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/RetryPolicy.java+class:androidx.camera.core.RetryPolicy.RetryConfig) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

*** ** * ** ***


```
@ExperimentalRetryPolicy
class RetryPolicy.RetryConfig
```

<br />

*** ** * ** ***

Represents the outcome of a `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy` decision.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/camera/core/ExperimentalRetryPolicy class https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig.Builder` A builder class for creating and customizing `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig` objects. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig` | `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#DEFAULT_DELAY_RETRY()` A RetryConfig indicating that the initialization should be retried after the default delay (determined by `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#getDefaultRetryDelayInMillis()`). |
| `const https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig` | `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#MINI_DELAY_RETRY()` A RetryConfig indicating that the initialization should be retried after a minimum delay of 100 milliseconds. |
| `const https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig` | `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#NOT_RETRY()` A RetryConfig indicating that no further retries should be attempted. |

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#getDefaultRetryDelayInMillis()()` Returns the recommended default delay to optimize retry attempts and camera recovery. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#getRetryDelayInMillis()()` Gets the delay time in milliseconds before the next retry attempt should be made. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#shouldRetry()()` Determines whether the initialization should be retried. |

## Constants

### DEFAULT_DELAY_RETRY

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
const val DEFAULT_DELAY_RETRY: RetryPolicy.RetryConfig
```

A RetryConfig indicating that the initialization should be retried after the default delay (determined by `https://developer.android.com/reference/kotlin/androidx/camera/core/RetryPolicy.RetryConfig#getDefaultRetryDelayInMillis()`). This delay provides sufficient time for typical device recovery processes, balancing retry efficiency and minimizing user wait time.

### MINI_DELAY_RETRY

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
const val MINI_DELAY_RETRY: RetryPolicy.RetryConfig
```

A RetryConfig indicating that the initialization should be retried after a minimum delay of 100 milliseconds. This short delay serves two purposes:

- Reduced Latency: Minimizes the wait time for the camera to become available, improving user experience.
- Camera Self-Recovery: Provides a brief window for the camera to potentially recover from temporary issues.
This approach balances quick retries with potential self-recovery, aiming for the fastest possible camera restoration.

### NOT_RETRY

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
const val NOT_RETRY: RetryPolicy.RetryConfig
```

A RetryConfig indicating that no further retries should be attempted.

## Public functions

### getDefaultRetryDelayInMillis

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
java-static fun getDefaultRetryDelayInMillis(): Long
```

Returns the recommended default delay to optimize retry attempts and camera recovery.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The default delay value, carefully calibrated based on extensive lab testing to: - Provide sufficient time for typical device recovery processes in common bad camera states. - Strike an optimal balance between minimizing latency and avoiding excessive retries, ensuring efficient camera initialization without unnecessary overhead. This value represents the generally recommended delay for most scenarios, striking a balance between providing adequate time for camera recovery and maintaining a smooth user experience. |

### getRetryDelayInMillis

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
fun getRetryDelayInMillis(): Long
```

Gets the delay time in milliseconds before the next retry attempt should be made.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The delay time in milliseconds. |

### shouldRetry

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
fun shouldRetry(): Boolean
```

Determines whether the initialization should be retried.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the initialization should be retried, false otherwise. |