public abstract class

ListenableWorker.Result

extends java.lang.Object

 java.lang.Object

↳androidx.work.ListenableWorker.Result

Subclasses:

ListenableWorker.Result.Success, ListenableWorker.Result.Failure, ListenableWorker.Result.Retry

Overview

The result of a ListenableWorker's computation. Call ListenableWorker.Result.success(), ListenableWorker.Result.failure(), or ListenableWorker.Result.retry() or one of their variants to generate an object indicating what happened in your background work.

Summary

Methods
public static ListenableWorker.Resultfailure()

Returns an instance of ListenableWorker.Result that can be used to indicate that the work completed with a permanent failure.

public static ListenableWorker.Resultfailure(Data outputData)

Returns an instance of ListenableWorker.Result that can be used to indicate that the work completed with a permanent failure.

public abstract DatagetOutputData()

public static ListenableWorker.Resultretry()

Returns an instance of ListenableWorker.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).

public static ListenableWorker.Resultsuccess()

Returns an instance of ListenableWorker.Result that can be used to indicate that the work completed successfully.

public static ListenableWorker.Resultsuccess(Data outputData)

Returns an instance of ListenableWorker.Result that can be used to indicate that the work completed successfully.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static ListenableWorker.Result success()

Returns an instance of ListenableWorker.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.

Returns:

An instance of ListenableWorker.Result indicating successful execution of work

public static ListenableWorker.Result success(Data outputData)

Returns an instance of ListenableWorker.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: A Data object that will be merged into the input Data of any OneTimeWorkRequest that is dependent on this work

Returns:

An instance of ListenableWorker.Result indicating successful execution of work

public static ListenableWorker.Result retry()

Returns an instance of ListenableWorker.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).

Returns:

An instance of ListenableWorker.Result indicating that the work needs to be retried

public static ListenableWorker.Result failure()

Returns an instance of ListenableWorker.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 ListenableWorker.Result.success() or ListenableWorker.Result.success(Data); failure indicates a permanent stoppage of the chain of work.

Returns:

An instance of ListenableWorker.Result indicating failure when executing work

public static ListenableWorker.Result failure(Data outputData)

Returns an instance of ListenableWorker.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 ListenableWorker.Result.success() or ListenableWorker.Result.success(Data); failure indicates a permanent stoppage of the chain of work.

Parameters:

outputData: A Data object that can be used to keep track of why the work failed

Returns:

An instance of ListenableWorker.Result indicating failure when executing work

public abstract Data getOutputData()

Returns:

The output Data which will be merged into the input Data of any OneTimeWorkRequest that is dependent on this work request.