From 209e75160a0e8ae27db8b7e464aa55e0b25d4785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sat, 25 May 2019 14:34:17 +0200 Subject: [PATCH] Fix network constraint in background sync (#348) --- .../java/io/github/wulkanowy/services/sync/SyncManager.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt index c1820afb..7f700bac 100644 --- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt +++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncManager.kt @@ -6,7 +6,7 @@ import androidx.work.BackoffPolicy.EXPONENTIAL import androidx.work.Constraints import androidx.work.ExistingPeriodicWorkPolicy.KEEP import androidx.work.ExistingPeriodicWorkPolicy.REPLACE -import androidx.work.NetworkType.METERED +import androidx.work.NetworkType.CONNECTED import androidx.work.NetworkType.UNMETERED import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager @@ -43,7 +43,7 @@ class SyncManager @Inject constructor( PeriodicWorkRequest.Builder(SyncWorker::class.java, preferencesRepository.servicesInterval, MINUTES, 10, MINUTES) .setBackoffCriteria(EXPONENTIAL, 30, MINUTES) .setConstraints(Constraints.Builder() - .setRequiredNetworkType(if (preferencesRepository.isServicesOnlyWifi) METERED else UNMETERED) + .setRequiredNetworkType(if (preferencesRepository.isServicesOnlyWifi) UNMETERED else CONNECTED) .build()) .build()) }