create

@ObjCName(swiftName = "create")
fun BackgroundTaskManager.Companion.create(tickIdentifier: String, eventListener: BackgrounderEventListener = BackgrounderEventListener.Noop): BackgroundTaskManager

iOS factory for BackgroundTaskManager. Installs the result as BackgroundTaskManager.shared.

Optional: BackgroundTaskManager.shared builds itself on first access using defaultTickIdentifier and no listener. Call this first only to supply a listener or your own tick identifier. A second live instance throws. The Swift call site reads:

let backgrounder = BackgroundTaskManager.companion.create(
tickIdentifier: "com.example.app.background-tick"
)
backgrounder.register(taskId: SyncWorker.companion.ID) { /* SyncWorker(…) */}
backgrounder.start()

Return

a constructed but not-yet-started BackgroundTaskManager. Call BackgroundTaskManager.register for every task id, then BackgroundTaskManager.start before the launch method returns.

The pre-execution WorkConstraints.networkRequired gate reads from Reachability.shared (process-lifetime singleton). Tests install a FakeReachability via the :reachable-testing artifact's withFakeReachability { … } helper, which transparently overrides Reachability.shared for the duration of the test block — no Backgrounder-specific test seam is required.

@OptIn(ExperimentalObjCName::class): required by SKIE for the Swift-rename annotation. Stable in practice.

Parameters

tickIdentifier

the iOS BGAppRefreshTaskRequest identifier the library uses to wake the periodic dispatcher in the background. Required. Must appear in your app's Info.plist under BGTaskSchedulerPermittedIdentifiers — pick something in your app's reverse-DNS namespace (e.g. "com.example.app.background-tick"). Even though it's used internally by Backgrounder, the identifier lives in your namespace because it surfaces in your Info.plist; the library never invents identifiers in your namespace for you. Validated at BackgroundTaskManager.start time and reported with a Kermit error if missing.

Periodic tasks (WorkRequest.Periodic) no longer need per-task id Info.plist entries — the tick identifier is the only entry they need. One-shot tasks (WorkRequest.OneTime) still register per-task id and still need their own Info.plist entries.

eventListener

observability hook for onScheduled, onStarted, onCompleted, onCancelled. Defaults to BackgrounderEventListener.Noop.