chore: set foreground service type for SyncDataJob

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-12-20 11:30:51 +11:00
parent 040c7a0fc1
commit cc5e14088c
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9

View File

@ -1,6 +1,8 @@
package eu.kanade.tachiyomi.data.sync
import android.content.Context
import android.content.pm.ServiceInfo
import android.os.Build
import androidx.work.CoroutineWorker
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.ExistingWorkPolicy
@ -47,6 +49,11 @@ class SyncDataJob(private val context: Context, workerParams: WorkerParameters)
return ForegroundInfo(
Notifications.ID_RESTORE_PROGRESS,
notifier.showSyncProgress().build(),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
} else {
0
},
)
}