Skip to content
Permalink
Browse files

Update to WorkManager 2.2.0 and tweak daily constraints

  • Loading branch information...
chrisbanes committed Aug 19, 2019
1 parent 657fd23 commit 8539c61e86c29f2d5856ad114b408b80976ed5f8
@@ -133,7 +133,7 @@ object Libs {
}

object Work {
private const val version = "2.1.0"
private const val version = "2.2.0"
const val runtimeKtx = "androidx.work:work-runtime-ktx:$version"
}
}
@@ -57,16 +57,17 @@ class ShowTasksImpl @Inject constructor(
}

override fun setupNightSyncs() {
val request = PeriodicWorkRequest.Builder(SyncAllFollowedShows::class.java,
24, TimeUnit.HOURS, 6, TimeUnit.HOURS)
.setConstraints(
Constraints.Builder()
.setRequiredNetworkType(NetworkType.UNMETERED)
.setRequiresCharging(true)
.setRequiresDeviceIdle(true)
.build()
)
.build()
val request = PeriodicWorkRequest.Builder(
SyncAllFollowedShows::class.java,
24, TimeUnit.HOURS,
12, TimeUnit.HOURS
).setConstraints(
Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.setRequiresBatteryNotLow(true)
.setRequiresDeviceIdle(true)
.build()
).build()

workManager.enqueueUniquePeriodicWork(
SyncAllFollowedShows.NIGHTLY_SYNC_TAG,

0 comments on commit 8539c61

Please sign in to comment.
You can’t perform that action at this time.