Java Code Examples for androidx.work.ExistingPeriodicWorkPolicy#REPLACE

The following examples show how to use androidx.work.ExistingPeriodicWorkPolicy#REPLACE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncManagerPresenter.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void syncData(int seconds, String scheduleTag) {
    preferenceProvider.setValue(Constants.TIME_DATA, seconds);
    workManagerController.cancelUniqueWork(scheduleTag);
    WorkerItem workerItem = new WorkerItem(scheduleTag, WorkerType.DATA, (long) seconds, null, null, ExistingPeriodicWorkPolicy.REPLACE);
    workManagerController.enqueuePeriodicWork(workerItem);
    checkData();
}
 
Example 2
Source File: SyncManagerPresenter.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void syncMeta(int seconds, String scheduleTag) {
    preferenceProvider.setValue(Constants.TIME_META, seconds);
    workManagerController.cancelUniqueWork(scheduleTag);
    WorkerItem workerItem = new WorkerItem(scheduleTag, WorkerType.METADATA, (long) seconds, null, null, ExistingPeriodicWorkPolicy.REPLACE);
    workManagerController.enqueuePeriodicWork(workerItem);
    checkData();
}