loading...

Android ADB Commands (Part 3) Jobs

neokleoys2005 profile image Giorgos Neokleous ・2 min read

ADB Commands

Previous posts:

According to documentation:

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

Link for more info.

3) Check a jobscheduler info using the following command:

adb shell dumpsys jobscheduler

As the output is huge, you should cmd+F or ctrl+f for your package name. It should look like

JOB #u0a93/17: eec3709 com.foo.bar.application/com.evernote.android.job.v21.PlatformJobService
    u0a93 tag=*job*/com.foo.bar.application/com.evernote.android.job.v21.PlatformJobService
    Source: uid=u0a93 user=0 pkg=com.samplejobscheduler.application
    JobInfo:
      Service: com.foo.bar.application/com.evernote.android.job.v21.PlatformJobService
      PERIODIC: interval=+15m0s0ms flex=+5m0s0ms
      PERSISTED
      Requires: charging=false deviceIdle=false
      Network type: 2
      Backoff: policy=1 initial=+30s0ms
      Has early constraint
      Has late constraint
    Required constraints: TIMING_DELAY DEADLINE UNMETERED
    Satisfied constraints: CONNECTIVITY NOT_ROAMING APP_NOT_IDLE DEVICE_NOT_DOZING
    Unsatisfied constraints: TIMING_DELAY DEADLINE UNMETERED
    Earliest run time: 07:23
    Latest run time: 12:23
    Ready: false (job=false pending=false active=false user=true)

As you can see, the requirements set when scheduling the job are included in the output as well as the backoff policy, network etc.
The most important info

Earliest run time: 07:23
Latest run time: 12:23
Ready: false (job=false pending=false active=false user=true)

If you are testing on Android 7.1 and higher, then you can force-run a scheduled job using the following command.

adb shell cmd jobscheduler run -f PACKAGE_NAME JOB_ID

PACKAGE_NAME should be the package of your app.
JOB_ID is set when scheduling a job

An excellent SO answer on how-to read the output and what tools are available for job schedulers check it out

Posted on by:

Discussion

pic
Editor guide