OneTimeWorkRequest


public final class OneTimeWorkRequest extends WorkRequest


A WorkRequest for non-repeating work.

OneTimeWorkRequests can be put in simple or complex graphs of work by using methods like WorkManager.enqueue or WorkManager.beginWith.

Summary

Nested types

Builder for OneTimeWorkRequests.

Public methods

static final @NonNull OneTimeWorkRequest

Creates a OneTimeWorkRequest with defaults from a ListenableWorker class name.

static final @NonNull List<@NonNull OneTimeWorkRequest>

Creates a list of OneTimeWorkRequests with defaults from an array of ListenableWorker class names.

Inherited methods

From androidx.work.WorkRequest
@NonNull UUID

The unique identifier associated with this unit of work.

Public methods

from

Added in 2.8.0
public static final @NonNull OneTimeWorkRequest from(@NonNull Class<@NonNull ListenableWorker> workerClass)

Creates a OneTimeWorkRequest with defaults from a ListenableWorker class name.

Parameters
@NonNull Class<@NonNull ListenableWorker> workerClass

An ListenableWorker class name

Returns
@NonNull OneTimeWorkRequest

A OneTimeWorkRequest constructed by using defaults in the Builder

from

public static final @NonNull List<@NonNull OneTimeWorkRequestfrom(@NonNull List<@NonNull Class<@NonNull ListenableWorker>> workerClasses)

Creates a list of OneTimeWorkRequests with defaults from an array of ListenableWorker class names.

Parameters
@NonNull List<@NonNull Class<@NonNull ListenableWorker>> workerClasses

A list of ListenableWorker class names

Returns
@NonNull List<@NonNull OneTimeWorkRequest>

A list of OneTimeWorkRequest constructed by using defaults in the [ ]