OneTimeWorkRequest


class OneTimeWorkRequest : 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

Public companion functions

OneTimeWorkRequest
from(workerClass: Class<ListenableWorker>)

Creates a OneTimeWorkRequest with defaults from a ListenableWorker class name.

List<OneTimeWorkRequest>
from(workerClasses: List<Class<ListenableWorker>>)

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

Inherited properties

From androidx.work.WorkRequest
open UUID

The unique identifier associated with this unit of work.

Public companion functions

from

Added in 2.8.0
fun from(workerClass: Class<ListenableWorker>): OneTimeWorkRequest

Creates a OneTimeWorkRequest with defaults from a ListenableWorker class name.

Parameters
workerClass: Class<ListenableWorker>

An ListenableWorker class name

Returns
OneTimeWorkRequest

A OneTimeWorkRequest constructed by using defaults in the Builder

from

fun from(workerClasses: List<Class<ListenableWorker>>): List<OneTimeWorkRequest>

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

Parameters
workerClasses: List<Class<ListenableWorker>>

A list of ListenableWorker class names

Returns
List<OneTimeWorkRequest>

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