Created
December 28, 2019 13:36
-
-
Save mahdi-malv/d0f804629d8d6ec8805bca03a9e63503 to your computer and use it in GitHub Desktop.
cancelAndroidJob
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
public static void cancelJob(Context c, int jobId) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
JobScheduler jobScheduler = | |
(JobScheduler) c.getSystemService(Context.JOB_SCHEDULER_SERVICE); | |
jobScheduler.cancel(jobId); | |
} | |
} | |
// Call it like this | |
cancelJob(context, jobId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment