WorkManagerScheduler.SchedulerWorker


class WorkManagerScheduler.SchedulerWorker : Worker


A Worker that starts the target service if the requirements are met.

Summary

Public constructors

SchedulerWorker(context: Context!, workerParams: WorkerParameters!)

Public functions

ListenableWorker.Result!

Override this method to do your actual background processing.

Inherited functions

From androidx.work.ListenableWorker
Context

Gets the application android.content.Context.

ListenableFuture<ForegroundInfo!>

Return an instance of ForegroundInfo if the WorkRequest is important to the user.

UUID

Gets the ID of the WorkRequest that created this Worker.

Data

Gets the input data.

Network?
@RequiresApi(value = 28)
getNetwork()

Gets the android.net.Network to use for this Worker.

@IntRange(from = 0) Int

Gets the current run attempt count for this work.

Int
@RequiresApi(value = 31)
getStopReason()

Returns a reason why this worker has been stopped.

(Mutable)Set<String!>

Gets a java.util.Set of tags associated with this Worker's WorkRequest.

(Mutable)List<String!>

Gets the list of content authorities that caused this Worker to execute.

(Mutable)List<Uri!>

Gets the list of content android.net.Uris that caused this Worker to execute.

Boolean

Returns true if this Worker has been told to stop.

Unit

This method is invoked when this Worker has been told to stop.

ListenableFuture<Void!>

This specifies that the WorkRequest is long-running or otherwise important.

ListenableFuture<Void!>

Updates ListenableWorker progress.

abstract ListenableFuture<ListenableWorker.Result!>

Override this method to start your actual background processing.

From androidx.work.Worker
ForegroundInfo!

An instance of ForegroundInfo if the WorkRequest is important to the user.

ListenableFuture<ForegroundInfo!>!

Return an instance of ForegroundInfo if the WorkRequest is important to the user.

ListenableFuture<ListenableWorker.Result!>!

Override this method to start your actual background processing.

Public constructors

SchedulerWorker

SchedulerWorker(context: Context!, workerParams: WorkerParameters!)

Public functions

doWork

fun doWork(): ListenableWorker.Result!

Override this method to do your actual background processing. This method is called on a background thread - you are required to synchronously do your work and return the androidx.work.ListenableWorker.Result from this method. Once you return from this method, the Worker is considered to have finished what its doing and will be destroyed. If you need to do your work asynchronously on a thread of your own choice, see ListenableWorker.

A Worker has a well defined execution window to finish its execution and return a androidx.work.ListenableWorker.Result. After this time has expired, the Worker will be signalled to stop.