fix: move startInitialization to inside the doWork method (#21984)

fix: android background backup

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-09-15 20:36:30 +05:30 committed by GitHub
parent dcee34095b
commit 5c06ec5e0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,12 +54,6 @@ class BackgroundWorker(context: Context, params: WorkerParameters) :
private var foregroundFuture: ListenableFuture<Void>? = null
init {
if (!loader.initialized()) {
loader.startInitialization(ctx)
}
}
companion object {
private const val NOTIFICATION_CHANNEL_ID = "immich::background_worker::notif"
private const val NOTIFICATION_ID = 100
@ -68,6 +62,10 @@ class BackgroundWorker(context: Context, params: WorkerParameters) :
override fun startWork(): ListenableFuture<Result> {
Log.i(TAG, "Starting background upload worker")
if (!loader.initialized()) {
loader.startInitialization(ctx)
}
val notificationChannel = NotificationChannel(
NOTIFICATION_CHANNEL_ID,
NOTIFICATION_CHANNEL_ID,