RetryPolicy.RetryConfig.Builder
@ExperimentalRetryPolicy
class RetryPolicy.RetryConfig.Builder
A builder class for creating and customizing RetryConfig objects.
While predefined configs like DEFAULT_DELAY_RETRY are recommended for typical recovery scenarios, this builder allows for fine-tuned control when specific requirements necessitate a different approach.
Summary
Public constructors |
|---|
Builder() |
Public functions |
|
|---|---|
RetryPolicy.RetryConfig |
build()Builds the customized |
RetryPolicy.RetryConfig.Builder |
setRetryDelayInMillis(timeoutInMillis: @IntRange(from = 100, to = 2000) Long)Sets the retry delay in milliseconds. |
RetryPolicy.RetryConfig.Builder |
setShouldRetry(shouldRetry: Boolean)Specifies whether a retry should be attempted. |
Public constructors
Public functions
build
fun build(): RetryPolicy.RetryConfig
Builds the customized RetryConfig object.
| Returns | |
|---|---|
RetryPolicy.RetryConfig |
The configured RetryConfig. |
setRetryDelayInMillis
fun setRetryDelayInMillis(timeoutInMillis: @IntRange(from = 100, to = 2000) Long): RetryPolicy.RetryConfig.Builder
Sets the retry delay in milliseconds.
If set, the initialization will be retried after the specified delay. For optimal results, the delay should be within the range of 100 to 2000 milliseconds. This aligns with lab testing, which suggests this range provides sufficient recovery time for most common camera issues while minimizing latency.
| Returns | |
|---|---|
RetryPolicy.RetryConfig.Builder |
|
setShouldRetry
fun setShouldRetry(shouldRetry: Boolean): RetryPolicy.RetryConfig.Builder
Specifies whether a retry should be attempted.
| Parameters | |
|---|---|
shouldRetry: Boolean |
If true (the default), initialization will be retried. If false, initialization will not be retried. |
| Returns | |
|---|---|
RetryPolicy.RetryConfig.Builder |
|