work/workmanager/src/main/java/androidx/work/impl/background/systemjob/SystemJobScheduler.java
public static void jobSchedulerCancelAll(@NonNull Context context) {
        JobScheduler jobScheduler = (JobScheduler)
                context.getSystemService(Context.JOB_SCHEDULER_SERVICE);

        if (jobScheduler != null) {
            List<JobInfo> jobInfos = jobScheduler.getAllPendingJobs();
            // Apparently this can be null on API 23?
            if (jobInfos != null) {
                for (JobInfo jobInfo : jobInfos) {
                    PersistableBundle extras = jobInfo.getExtras();
                    // This is a job scheduled by WorkManager.
                    if (extras.containsKey(SystemJobInfoConverter.EXTRA_WORK_SPEC_ID)) {
                        jobScheduler.cancel(jobInfo.getId());
                    }
                }
            }
        }
    }
/**
     * Cancels all the jobs owned by {@link androidx.work.WorkManager} in {@link JobScheduler}.
     */
Cancels all the jobs owned by  androidx.work.WorkManager in  JobScheduler.
Cancels all the jobs owned by androidx . work . WorkManager in JobScheduler .
public static void jobSchedulerCancelAll(@NonNull Context context) {
        JobScheduler jobScheduler = (JobScheduler)
                context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
        if (jobScheduler != null) {
            List<JobInfo> jobInfos = jobScheduler.getAllPendingJobs();
            if (jobInfos != null) {
                for (JobInfo jobInfo : jobInfos) {
                    PersistableBundle extras = jobInfo.getExtras();
                    if (extras.containsKey(SystemJobInfoConverter.EXTRA_WORK_SPEC_ID)) {
                        jobScheduler.cancel(jobInfo.getId());
                    }
                }
            }
        }
    }
public static void jobSchedulerCancelAll ( @ NonNull Context context ) { JobScheduler jobScheduler = ( JobScheduler ) context . getSystemService ( Context . JOB_SCHEDULER_SERVICE ) ; if ( jobScheduler != null ) { List < JobInfo > jobInfos = jobScheduler . getAllPendingJobs ( ) ; if ( jobInfos != null ) { for ( JobInfo jobInfo : jobInfos ) { PersistableBundle extras = jobInfo . getExtras ( ) ; if ( extras . containsKey ( SystemJobInfoConverter . EXTRA_WORK_SPEC_ID ) ) { jobScheduler . cancel ( jobInfo . getId ( ) ) ; } } } } }
Cancels all the jobs owned by {@link androidx.work.WorkManager} in {@link JobScheduler}.
Cancels all the jobs owned by { @link androidx . work . WorkManager } in { @link JobScheduler } .
// Apparently this can be null on API 23? // This is a job scheduled by WorkManager.