WorkerParametersExtensions

Added in 2.10.0

public final class WorkerParametersExtensions


Summary

Public methods

static final boolean
static final @NonNull WorkerParameters
<T extends ListenableWorker> usingRemoteService(
    @NonNull WorkerParameters receiver,
    @NonNull ComponentName componentName
)

Returns a new instance of WorkerParameters representing a WorkRequest that can run in a process corresponding to the provided ComponentName.

static final @NonNull WorkerParameters
usingRemoteService(
    @NonNull WorkerParameters receiver,
    @NonNull String workerClassName,
    @NonNull ComponentName componentName
)

Returns a new instance of WorkerParameters representing a WorkRequest that can run in a process corresponding to the provided ComponentName.

Public methods

isRemoteWorkRequest

public static final boolean isRemoteWorkRequest(@NonNull WorkerParameters receiver)
Returns
boolean

true if and only if the instance of WorkerParameters corresponds to a WorkRequest that runs in a remote process.

usingRemoteService

public static final @NonNull WorkerParameters <T extends ListenableWorker> usingRemoteService(
    @NonNull WorkerParameters receiver,
    @NonNull ComponentName componentName
)

Returns a new instance of WorkerParameters representing a WorkRequest that can run in a process corresponding to the provided ComponentName.

Parameters
<T extends ListenableWorker>

The ListenableWorker to delegate to.

@NonNull ComponentName componentName

The ComponentName that identifies the RemoteService that hosts the WorkRequest.

Returns
@NonNull WorkerParameters

A new instance of WorkerParameters

usingRemoteService

public static final @NonNull WorkerParameters usingRemoteService(
    @NonNull WorkerParameters receiver,
    @NonNull String workerClassName,
    @NonNull ComponentName componentName
)

Returns a new instance of WorkerParameters representing a WorkRequest that can run in a process corresponding to the provided ComponentName.

Parameters
@NonNull String workerClassName

The fully qualified class name of the ListenableWorker to delegate to

@NonNull ComponentName componentName

The ComponentName that identifies the RemoteService that hosts the WorkRequest.

Returns
@NonNull WorkerParameters

A new instance of WorkerParameters