Class BackgroundWork
java.lang.Object
com.codename1.background.BackgroundWork
Entry point for scheduling constraint-aware background work. On Android this maps to
WorkManager and on iOS to BGTaskScheduler. In the simulator the work runs on a timer
and honors the constraint toggles in the Simulate menu.
See also
-
WorkRequest
-
BackgroundWorker
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidCancels previously scheduled work by id.static booleanReturns true if the current platform supports constraint-aware background work.static voidschedule(WorkRequest request) Schedules a unit of background work.
-
Method Details
-
schedule
Schedules a unit of background work. If a request with the same id was previously scheduled it is replaced. On platforms that do not support background work this is a no-op; check
#isSupported()first.Parameters
request: the work request to schedule
-
cancel
Cancels previously scheduled work by id.
Parameters
workId: the id of the work to cancel
-
isSupported
public static boolean isSupported()Returns true if the current platform supports constraint-aware background work.
Returns
true if background work is supported
-