TaskRequest
constructor(id: String, type: TaskType, constraints: Constraints = Constraints(), retryPolicy: RetryPolicy = RetryPolicy.None, priority: TaskPriority = TaskPriority.NORMAL, tags: Set<String> = emptySet(), payload: String? = null, label: String? = null)
Parameters
id
Unique identifier for the task. Used for registration, cancellation, and observation.
type
Whether this is a TaskType.OneTime or TaskType.Periodic task.
constraints
Platform constraints that must be satisfied before execution.
retryPolicy
How the task should be retried on failure.
priority
Execution priority hint. See TaskPriority.
tags
Optional set of string labels for group cancellation or filtering.
payload
Optional serialized data passed to the task handler via TaskExecutionContext.payload.
label
Optional human-readable display name for this task (used in logs and future foreground-service notifications). Defaults to id if not set.