shared

The process-wide BackgroundTaskManager.

BackgroundTaskManager.shared.register(SyncWorker.ID) { SyncWorker(repo = graph.repository) }
BackgroundTaskManager.shared.start()
  • Android: populated before Application.onCreate by the androidx.startup initializer the library registers in its manifest. If your app removed the InitializationProvider, call BackgroundTaskManager.configure(application) first; accessing shared before either has run throws IllegalStateException with that instruction.

  • iOS / macOS / JVM: created lazily on first access. Call BackgroundTaskManager.create(...) first only if you need a BackgrounderEventListener or, on iOS, a custom tick identifier.

Swift sees this as BackgroundTaskManager.shared through a wrapper bundled in the framework. @HiddenFromObjC here because Kotlin/Native already exports every companion object with a shared accessor of its own, so a Kotlin property of the same name would collide; the wrapper calls sharedInstance.

@OptIn(ExperimentalObjCRefinement::class): standard SKIE-recognised refinement annotation; stable in practice (CLAUDE.md §8).