Result
abstract class Result
kotlin.Any | |
↳ | androidx.work.ListenableWorker.Result |
The result of a ListenableWorker
's computation. Call success()
, failure()
, or retry()
or one of their variants to generate an object indicating what happened in your background work.
Summary
Public methods |
|
---|---|
open static ListenableWorker.Result |
failure() Returns an instance of |
open static ListenableWorker.Result |
Returns an instance of |
open static ListenableWorker.Result |
retry() Returns an instance of |
open static ListenableWorker.Result |
success() Returns an instance of |
open static ListenableWorker.Result |
Returns an instance of |
Public methods
failure
@NonNull open static fun failure(): ListenableWorker.Result
Returns an instance of Result
that can be used to indicate that the work completed with a permanent failure. Any work that depends on this will also be marked as failed and will not be run. If you need child workers to run, you need to use success()
or success(Data)
; failure indicates a permanent stoppage of the chain of work.
Return | |
---|---|
ListenableWorker.Result: An instance of Result indicating failure when executing work |
failure
@NonNull open static fun failure(@NonNull outputData: Data): ListenableWorker.Result
Returns an instance of Result
that can be used to indicate that the work completed with a permanent failure. Any work that depends on this will also be marked as failed and will not be run. If you need child workers to run, you need to use success()
or success(Data)
; failure indicates a permanent stoppage of the chain of work.
Parameters | |
---|---|
outputData |
Data: A Data object that can be used to keep track of why the work failed |
Return | |
---|---|
ListenableWorker.Result: An instance of Result indicating failure when executing work |
retry
@NonNull open static fun retry(): ListenableWorker.Result
Returns an instance of Result
that can be used to indicate that the work encountered a transient failure and should be retried with backoff specified in WorkRequest.Builder#setBackoffCriteria(BackoffPolicy, long, TimeUnit)
.
Return | |
---|---|
ListenableWorker.Result: An instance of Result indicating that the work needs to be retried |
success
@NonNull open static fun success(): ListenableWorker.Result
Returns an instance of Result
that can be used to indicate that the work completed successfully. Any work that depends on this can be executed as long as all of its other dependencies and constraints are met.
Return | |
---|---|
ListenableWorker.Result: An instance of Result indicating successful execution of work |
success
@NonNull open static fun success(@NonNull outputData: Data): ListenableWorker.Result
Returns an instance of Result
that can be used to indicate that the work completed successfully. Any work that depends on this can be executed as long as all of its other dependencies and constraints are met.
Parameters | |
---|---|
outputData |
Data: A Data object that will be merged into the input Data of any OneTimeWorkRequest that is dependent on this work |
Return | |
---|---|
ListenableWorker.Result: An instance of Result indicating successful execution of work |