RemoteListenableWorker
public abstract class RemoteListenableWorker extends ListenableWorker
| java.lang.Object | ||
| ↳ | androidx.work.ListenableWorker | |
| ↳ | androidx.work.multiprocess.RemoteListenableWorker |
RemoteCoroutineWorker |
An implementation of |
Is an implementation of a ListenableWorker that can bind to a remote process.
To be able to bind to a remote process, A RemoteListenableWorker needs additional arguments as part of its input Data.
The arguments (ARGUMENT_PACKAGE_NAME, ARGUMENT_CLASS_NAME) are used to determine the android.app.Service that the RemoteListenableWorker can bind to. startRemoteWork is then subsequently called in the process that the android.app.Service is running in.
Summary
Constants |
|
|---|---|
static final String |
ARGUMENT_CLASS_NAME = "androidx.work.impl.workers.RemoteListenableWorker.ARGUMENT_CLASS_NAME"The |
static final String |
ARGUMENT_PACKAGE_NAME = "androidx.work.impl.workers.RemoteListenableWorker.ARGUMENT_PACKAGE_NAME"The |
Public constructors |
|---|
RemoteListenableWorker( |
Public methods |
|
|---|---|
abstract @NonNull ListenableFuture<ListenableWorker.Result> |
Override this method to define the work that needs to run in the remote process. |
final @NonNull ListenableFuture<ListenableWorker.Result> |
Override this method to start your actual background processing. |
Inherited methods |
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
ARGUMENT_CLASS_NAME
public static final String ARGUMENT_CLASS_NAME = "androidx.work.impl.workers.RemoteListenableWorker.ARGUMENT_CLASS_NAME"
The ARGUMENT_PACKAGE_NAME, className together determine the ComponentName that the RemoteListenableWorker binds to before calling startRemoteWork.
ARGUMENT_PACKAGE_NAME
public static final String ARGUMENT_PACKAGE_NAME = "androidx.work.impl.workers.RemoteListenableWorker.ARGUMENT_PACKAGE_NAME"
The #ARGUMENT_PACKAGE_NAME, ARGUMENT_CLASS_NAME together determine the ComponentName that the RemoteListenableWorker binds to before calling startRemoteWork.
Public constructors
RemoteListenableWorker
public RemoteListenableWorker(
@NonNull Context appContext,
@NonNull WorkerParameters workerParams
)
| Parameters | |
|---|---|
@NonNull Context appContext |
The application |
@NonNull WorkerParameters workerParams |
|
Public methods
startRemoteWork
public abstract @NonNull ListenableFuture<ListenableWorker.Result> startRemoteWork()
Override this method to define the work that needs to run in the remote process. This method is called on the main thread.
A ListenableWorker has a well defined execution window to to finish its execution and return a androidx.work.ListenableWorker.Result. After this time has expired, the worker will be signalled to stop and its ListenableFuture will be cancelled. Note that the execution window also includes the cost of binding to the remote process.
The RemoteListenableWorker will also be signalled to stop when its constraints are no longer met.
| Returns | |
|---|---|
@NonNull ListenableFuture<ListenableWorker.Result> |
A |
startWork
public final @NonNull ListenableFuture<ListenableWorker.Result> startWork()
Override this method to start your actual background processing. This method is called on the main thread.
A ListenableWorker has a well defined execution window to to finish its execution and return a Result. After this time has expired, the worker will be signalled to stop and its com.google.common.util.concurrent.ListenableFuture will be cancelled.
The future will also be cancelled if this worker is stopped for any reason (see onStopped).
| Returns | |
|---|---|
@NonNull ListenableFuture<ListenableWorker.Result> |
A |