Created
July 4, 2019 18:57
-
-
Save magdamiu/51b01ef9e2a3993e56819daa765c902a to your computer and use it in GitHub Desktop.
Apply Constraints on the task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val constraints = Constraints.Builder() | |
.setRequiresCharging(true) | |
.setRequiresStorageNotLow(true) | |
.setRequiredNetworkType(NetworkType.CONNECTED) | |
.build() | |
val syncOnlyOnce = OneTimeWorkRequestBuilder<SyncDataWorker>() | |
.setConstraints(constraints) | |
.build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment