register

@ObjCName(swiftName = "register")
fun register(taskId: String, factory: () -> BackgroundWorker)

Associate taskId with a factory that builds a fresh BackgroundWorker per dispatch.

Must be called before BackgroundTaskManager.start. Throws if the registry is already sealed or taskId is already claimed by another per-id registration or a BackgroundWorkerFactory.

Throws

if the registry is sealed.

if taskId is already registered.


@ObjCName(swiftName = "register")
fun register(factory: BackgroundWorkerFactory)

Register a BackgroundWorkerFactory that owns the ids in BackgroundWorkerFactory.taskIds.

Must be called before BackgroundTaskManager.start. Throws if the registry is already sealed or any of the factory's ids collide with a per-id registration or another factory.

Throws

if the registry is sealed.

if any of BackgroundWorkerFactory.taskIds is already registered, or the factory declares no ids.