1

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
  • 67
  • 6

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.
  • 28,775
  • 16
  • 113
  • 160
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
  • 12,860
  • 5
  • 62
  • 83