RemoteWorkManager
public
abstract
class
RemoteWorkManager
extends Object
| java.lang.Object | |
| ↳ | androidx.work.multiprocess.RemoteWorkManager |
A subset of WorkManager APIs that are available for apps that use
multiple processes.
Summary
Public methods | |
|---|---|
abstract
RemoteWorkContinuation
|
beginUniqueWork(String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, List<OneTimeWorkRequest> work)
This method allows you to begin unique chains of work for situations where you only want one chain with a given name to be active at a time. |
final
RemoteWorkContinuation
|
beginUniqueWork(String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, OneTimeWorkRequest work)
This method allows you to begin unique chains of work for situations where you only want one chain with a given name to be active at a time. |
final
RemoteWorkContinuation
|
beginWith(OneTimeWorkRequest work)
Begins a chain with one or more |
abstract
RemoteWorkContinuation
|
beginWith(List<OneTimeWorkRequest> work)
Begins a chain with one or more |
abstract
ListenableFuture<Void>
|
cancelAllWork()
Cancels all unfinished work. |
abstract
ListenableFuture<Void>
|
cancelAllWorkByTag(String tag)
Cancels all unfinished work with the given tag. |
abstract
ListenableFuture<Void>
|
cancelUniqueWork(String uniqueWorkName)
Cancels all unfinished work in the work chain with the given name. |
abstract
ListenableFuture<Void>
|
cancelWorkById(UUID id)
Cancels work with the given id if it isn't finished. |
abstract
ListenableFuture<Void>
|
enqueue(WorkRequest request)
Enqueues one item for background processing. |
abstract
ListenableFuture<Void>
|
enqueue(List<WorkRequest> requests)
Enqueues one or more items for background processing. |
abstract
ListenableFuture<Void>
|
enqueueUniquePeriodicWork(String uniqueWorkName, ExistingPeriodicWorkPolicy existingPeriodicWorkPolicy, PeriodicWorkRequest periodicWork)
This method allows you to enqueue a uniquely-named |
final
ListenableFuture<Void>
|
enqueueUniqueWork(String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, OneTimeWorkRequest work)
This method allows you to enqueue |
abstract
ListenableFuture<Void>
|
enqueueUniqueWork(String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, List<OneTimeWorkRequest> work)
This method allows you to enqueue |
static
RemoteWorkManager
|
getInstance(Context context)
Gets the instance of |
abstract
ListenableFuture<List<WorkInfo>>
|
getWorkInfos(WorkQuery workQuery)
Gets the |
Inherited methods | |
|---|---|
Public methods
beginUniqueWork
public abstract RemoteWorkContinuation beginUniqueWork (String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, List<OneTimeWorkRequest> work)
This method allows you to begin unique chains of work for situations where you only want one chain with a given name to be active at a time. For example, you may only want one sync operation to be active. If there is one pending, you can choose to let it run or replace it with your new work.
The uniqueWorkName uniquely identifies this set of work.
If this method determines that new work should be enqueued and run, all records of previous
work with uniqueWorkName will be pruned. If this method determines that new work
should NOT be run, then the entire chain will be considered a no-op.
If any work in the chain fails or is cancelled, all of its dependent work inherits that state
and will never run. This is particularly important if you are using APPEND as your
ExistingWorkPolicy.
| Parameters | |
|---|---|
uniqueWorkName |
String: A unique name which for this chain of work |
existingWorkPolicy |
ExistingWorkPolicy: An ExistingWorkPolicy; see below for more information |
work |
List: One or more OneTimeWorkRequest to enqueue. REPLACE ensures that
if there is pending work labelled with uniqueWorkName, it will be
cancelled and the new work will run. KEEP will run the new sequence of
work only if there is no pending work labelled with uniqueWorkName.
APPEND will create a new sequence of work if there is no
existing work with uniqueWorkName; otherwise, work will be added
as a child of all leaf nodes labelled with uniqueWorkName. |
| Returns | |
|---|---|
RemoteWorkContinuation |
A RemoteWorkContinuation that allows further chaining
|
beginUniqueWork
public final RemoteWorkContinuation beginUniqueWork (String uniqueWorkName, ExistingWorkPolicy existingWorkPolicy, OneTimeWorkRequest work)
This method allows you to begin unique chains of work for situations where you only want one chain with a given name to be active at a time. For example, you may only want one sync operation to be active. If there is one pending, you can choose to let it run or replace it with your new work.
The <code tra