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