AndroidKmpWorker
class AndroidKmpWorker(context: Context, eventStore: EventStore? = null, chainRepo: ChainRepository? = null, telemetry: TelemetryCollector? = null, val foregroundConfig: ForegroundConfig? = null) : KmpWorker
Android concrete implementation of KmpWorker.
Instantiate once (e.g. in your Application class) and inject throughout the app. Jetpack Startup (KmpWorkerInitializer) pre-warms WorkManager automatically — no manual initialization required beyond creating this instance.
class MyApp : Application() {
val kmpWorker: KmpWorker by lazy {
AndroidKmpWorker(
context = this,
eventStore = SqlDelightEventStore(database), // optional, enables cold-launch replay
chainRepo = SqlDelightChainRepository(database) // optional, enables TaskChain support
)
}
}Content copied to clipboard
Parameters
context
Application context.
eventStore
Optional persistent event store. Install to enable cold-launch completion replay.
chainRepo
Optional chain repository. Required for enqueueChain support.
Constructors
Link copied to clipboard
constructor(context: Context, eventStore: EventStore? = null, chainRepo: ChainRepository? = null, telemetry: TelemetryCollector? = null, foregroundConfig: ForegroundConfig? = null)
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun registerWithContext(taskId: String, block: suspend TaskExecutionContext.() -> Unit)