Class BackgroundWork

java.lang.Object
com.codename1.background.BackgroundWork

public final class BackgroundWork extends Object

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 Details

    • schedule

      public static void schedule(WorkRequest request)

      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

      public static void cancel(String workId)

      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