Created
May 10, 2018 10:14
-
-
Save brainail/e50d25c4fc6e0a05da95d9709e0e6404 to your computer and use it in GitHub Desktop.
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
fun hardWorkerRunner(): WorkRequest { | |
val hardWork = OneTimeWorkRequest.Builder(HardWorker::class.java).build() | |
WorkManager.getInstance().enqueue(hardWork) | |
return hardWork | |
} | |
fun hardWorkerStopper() { | |
val hardWorkId = hardWorkerRunner().id | |
WorkManager.getInstance().cancelWorkById(hardWorkId) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment