androidx.work.ListenableWorker Java Examples
The following examples show how to use
androidx.work.ListenableWorker.
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: GndWorkerFactory.java From ground-android with Apache License 2.0 | 6 votes |
@Nullable @Override public ListenableWorker createWorker( @NonNull Context appContext, @NonNull String workerClassName, @NonNull WorkerParameters params) { // There are more generic and robust ways of doing this, but individual constructors are // hard-coded for simplicity. If and when github.com/google/dagger/issues/1183 is implemented // this class can be removed in favor of DI. if (workerClassName.equals(LocalMutationSyncWorker.class.getName())) { return new LocalMutationSyncWorker( appContext, params, localDataStore, remoteDataStore, notificationManager); } else if (workerClassName.equals(TileDownloadWorker.class.getName())) { return new TileDownloadWorker(appContext, params, localDataStore, notificationManager); } else if (workerClassName.equals(PhotoSyncWorker.class.getName())) { return new PhotoSyncWorker(appContext, params, remoteStorageManager, notificationManager); } else { throw new IllegalArgumentException("Unknown worker class " + workerClassName); } }
Example #2
Source File: AsyncWorker.java From GeometricWeather with GNU Lesser General Public License v3.0 | 6 votes |
@SuppressLint("RestrictedApi") @Override public final @NonNull ListenableFuture<ListenableWorker.Result> startWork() { // Package-private to avoid synthetic accessor. SettableFuture<Result> future = SettableFuture.create(); doAsyncWork(future); return future; }
Example #3
Source File: AttachmentHandler.java From tindroid with Apache License 2.0 | 4 votes |
@NonNull @Override public ListenableWorker.Result doWork() { return doUpload(getApplicationContext(), getInputData()); }
Example #4
Source File: WorkManagerUtils.java From cathode with Apache License 2.0 | 4 votes |
public static void enqueueNow(WorkManager workManager, Class<? extends ListenableWorker> workerClass) { WorkmanagerKt.enqueueNow(workManager, workerClass, null, true); }
Example #5
Source File: WorkManagerUtils.java From cathode with Apache License 2.0 | 4 votes |
public static void enqueueUniqueNow(WorkManager workManager, String tag, Class<? extends ListenableWorker> workerClass) { WorkmanagerKt.enqueueUniqueNow(workManager, tag, workerClass, ExistingWorkPolicy.APPEND, null, true); }
Example #6
Source File: WorkManagerUtils.java From cathode with Apache License 2.0 | 4 votes |
public static void enqueueDelayed(WorkManager workManager, Class<? extends ListenableWorker> workerClass, long delayMs) { WorkmanagerKt.enqueueDelayed(workManager, workerClass, delayMs, null, true); }
Example #7
Source File: SyncPresenter.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | votes |
ListenableWorker.Result blockSyncGranularProgram(String programUid);
Example #8
Source File: SyncPresenter.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | votes |
ListenableWorker.Result blockSyncGranularTei(String teiUid);
Example #9
Source File: SyncPresenter.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | votes |
ListenableWorker.Result blockSyncGranularEvent(String eventUid);
Example #10
Source File: SyncPresenter.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | votes |
ListenableWorker.Result blockSyncGranularDataSet(String dataSetUid);
Example #11
Source File: SyncPresenter.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | votes |
ListenableWorker.Result blockSyncGranularDataValues(String dataSetUid, String orgUnitUid, String attrOptionCombo, String periodId, String[] catOptionCombo);
Example #12
Source File: AsyncWorker.java From GeometricWeather with GNU Lesser General Public License v3.0 | votes |
public abstract void doAsyncWork(SettableFuture<ListenableWorker.Result> future);