2

With improper enquing jobs, there can be easily mess, is there any adb command to remove all pending and active jobs (showed by adb shell dumpsys jobscheduler)

Yhdista
  • 77
  • 7

2 Answers2

2

To call JobScheduler.cancelAll() via adb use:

adb shell service call jobscheduler 5

For finer control use JobScheduler.cancel(int jobId):

adb shell service call jobscheduler 4 i32 <jobId>

To confirm the proper service call codes for your Android version read

https://stackoverflow.com/a/25987165/1778421

Alex P.
  • 30,437
  • 17
  • 118
  • 169
1

Jobs cancelling support was recently added to ADB, can be invoked using cmd jobscheduler command.

Sample execution:

$ adb shell cmd jobscheduler cancel com.my.packagename  
Canceling all jobs for com.my.packagename in user 0

The command documentation says the following (copied from a device running Android 11):

  cancel [-u | --user USER_ID] PACKAGE [JOB_ID]
    Cancel a scheduled job.  If a job ID is not supplied, all jobs scheduled
    by that package will be canceled.  USE WITH CAUTION.
    Options:
      -u or --user: specify which user's job is to be run; the default is
         the primary or system user
Alex Lipov
  • 13,503
  • 5
  • 64
  • 87