WorkManager code snippet

Eungi KimΒ·2020λ…„ 11μ›” 26일
0
this.mUsbRealDisconnectionWorkRequest = new OneTimeWorkRequest.Builder(UsbRealDisconnectionWorker.class)
        .addTag(UsbRealDisconnectionWorker.WORKER_TAG)
        .setInitialDelay(11, TimeUnit.MINUTES)
        .build();

WorkManager workManager = WorkManager.getInstance(mContext);
workManager.enqueueUniqueWork(UsbRealDisconnectionWorker.WORKER_TAG
        , ExistingWorkPolicy.REPLACE
        , mUsbRealDisconnectionWorkRequest);

WorkManager.getInstance(mContext).cancelAllWorkByTag(UsbRealDisconnectionWorker.WORKER_TAG);

좜처: limgyumin 미디움

profile
Run and gun and debugun

0개의 λŒ“κΈ€