Created
May 26, 2020 14:37
-
-
Save Ikhiloya/875b97d7afebab0fb45f344a37861825 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 periodicSyncDataWork = PeriodicWorkRequest.Builder(BeneficiaryWorker::class.java, 15, TimeUnit.MINUTES) | |
| .addTag(Constant.TAG_SYNC_BENEFICIARY) | |
| .setConstraints(constraints) // setting a backoff on case the work needs to retry | |
| .setBackoffCriteria( | |
| BackoffPolicy.LINEAR, | |
| PeriodicWorkRequest.MIN_BACKOFF_MILLIS, | |
| TimeUnit.MILLISECONDS | |
| ) | |
| .build() | |
| getWorkManager()!!.enqueueUniquePeriodicWork( | |
| Constant.SYNC_BENEFICIARY_WORK_NAME, | |
| ExistingPeriodicWorkPolicy.KEEP, //Existing Periodic Work policy | |
| periodicSyncDataWork //work request | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment