Debug your WorkManager Workers with Background Task Inspector

In Android Studio Arctic Fox and higher, the Background Task Inspector helps you to visualize, monitor, and debug your app's background workers when using WorkManager library 2.5.0 or higher.

Get started

To list workers in the Background Task Inspector, do the following:

  1. Run your app on an emulator or connected device running API level 26 or higher.

  2. Select View > Tool Windows > App Inspection from the menu bar.

  3. Select the Background Task Inspector tab.

  4. Select the running app process from the dropdown menu.

  5. The workers in the currently running app appear in the Background Task Inspector pane. Click on the worker that you want to inspect further.

View and Inspect workers

When you deploy an app using WorkManager 2.5.0 or higher on a device running API level 26 or higher, you should see active workers in the Background Task Inspector tab, as shown below.

Screenshot of the Background Task Inspector window.
Figure 1. The Background Task Inspector window.

The Background Task Inspector lists the class name, current state, start time, retries, and the output data of all the jobs whether they are running, failed or completed.

Work Details

Clicking on a specific job from the list opens the Work Details panel, which displays detailed information of the worker.

Screenshot of the selected Worker's details.
Figure 2. Work Details.

Description

The Description section lists the Worker class name with the fully-qualified package, as well as the assigned tag and the UUID of this worker.

Execution

The Execution section shows the worker’s constraints (if any), running frequency, its state, and which class created and queued this worker.

WorkContuniation

The WorkContinuation section displays where this worker is in the work chain. To check the details of another worker in the work chain, click on its UUID.

Results

The Results section displays the start time, retry count, and the output data of the selected worker.

Cancel workers

To stop a currently running or enqueued worker, select the worker, and click Cancel Selected Worker from the toolbar.

View Graph View

Because workers can be chained together, it’s sometimes useful to visualize worker dependencies as a graph. To see a visual representation of a worker chain, select a worker from the table, and click Show Graph View from the toolbar.

Screenshot of the Graph view.
Figure 3. Graph View.

The graph allows you to quickly see relationships between workers and monitor their progress in complex chaining relationships.

To return to the list view, click Show List View .

Additional resources

To learn more about the Background Task Inspector, see the following additional resources:

Documentation

Codelabs

Blog posts