Companion

object Companion

Companion object exists so per-platform source sets can install extension entry points: BackgroundTaskManager.shared (commonMain), BackgroundTaskManager.configure(application) (Android), and BackgroundTaskManager.create(...) (iOS / macOS / JVM). commonMain cannot define the constructors itself because the Android variant requires an Application and the Apple variants don't — there's no common signature that doesn't leak Any?.

Functions

Link copied to clipboard
fun BackgroundTaskManager.Companion.configure(application: Application, eventListener: BackgrounderEventListener = BackgrounderEventListener.Noop, workManager: WorkManager? = null): BackgroundTaskManager

Android entry point: builds the process-wide BackgroundTaskManager and installs it as BackgroundTaskManager.shared.

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

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

fun BackgroundTaskManager.Companion.create(eventListener: BackgrounderEventListener = BackgrounderEventListener.Noop): BackgroundTaskManager

JVM (desktop / server) factory for BackgroundTaskManager.

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

macOS factory for BackgroundTaskManager.

Link copied to clipboard
@ObjCName(swiftName = "defaultTickIdentifier")
fun BackgroundTaskManager.Companion.defaultTickIdentifier(): String

The tick identifier BackgroundTaskManager.shared uses when the app never called create: the main bundle identifier plus .backgrounder-tick (e.g. dev.example.app.backgrounder-tick). It must appear in BGTaskSchedulerPermittedIdentifiers; the Gradle plugin adds it when backgrounder.iosBundleIdentifier is set. Exposed so apps that maintain the plist by hand can read the exact string.

Link copied to clipboard

Objective-C-visible accessor for shared. Swift callers use BackgroundTaskManager.shared, a bundled wrapper over this function; Kotlin callers use the shared property. Exists only because the property name collides with Kotlin/Native's generated companion accessor.