ScheduledTask

data class ScheduledTask(val taskId: String, val kind: ScheduledTask.Kind, val state: ScheduledTask.State, val nextRunHint: Instant?, val attempt: Int, val ephemeral: Boolean, val pendingPredicates: List<PendingPredicate> = emptyList())

A snapshot of one scheduled task's current state — returned from Scheduler.scheduled for inspection.

Best-effort per platform:

  • Android: derived from WorkInfo directly.

  • iOS: combined view of the library's state store and BGTaskScheduler.getPendingTaskRequests. The library does not directly observe a worker between handler-fire and setTaskCompletedSuccess, so that span is reported as State.Pending rather than State.Running.

Constructors

Link copied to clipboard
constructor(taskId: String, kind: ScheduledTask.Kind, state: ScheduledTask.State, nextRunHint: Instant?, attempt: Int, ephemeral: Boolean, pendingPredicates: List<PendingPredicate> = emptyList())

Types

Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard

Library-tracked retry attempt counter (within a cycle for periodic).

Link copied to clipboard

true if this task was scheduled with WorkRequest.ephemeral = true.

Link copied to clipboard

Whether this task was scheduled as a one-time or repeating request.

Link copied to clipboard

Best-effort hint of when the platform plans to run this next. May be null.

Link copied to clipboard

Conditions currently preventing this task from running, surfaced so inspector UIs can answer "why isn't this dispatching yet?". Best-effort per platform; see PendingPredicate for platform support caveats. Empty when nothing is blocking dispatch.

Link copied to clipboard

Current execution state; see State for per-platform accuracy caveats.

Link copied to clipboard

The task id this task was scheduled under.