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.
To list workers in the Background Task Inspector, do the following:
Run your app on an emulator or connected device running API level 26 or higher.
Select View > Tool Windows > App Inspection from the menu bar.
Select the Background Task Inspector tab.
Select the running app process from the dropdown menu.
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. The Background Task Inspector, shown below, lists the class name, current status, start time, and retries of all the jobs whether they are running, failed, or completed.
Clicking on a specific job from the list opens the Work Details panel, which displays detailed information of the worker.
- Description: This section lists the Worker class name with the fully-qualified package, as well as the assigned tag and the UUID of this worker.
- Execution: This section shows the worker’s constraints (if any), running frequency, its state, and which class created and queued this worker.
- WorkContuniation: This 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: This section displays the start time, retry count, and the output data of the selected worker.
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. Only workers are drawn in the graph.
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 .
View and Inspect Jobs, Alarms, and Wakelocks
The Background Task Inspector also allows you to inspect your app’s Jobs, Alarms, and Wakelocks. Each type of asynchronous task now appears under the appropriate heading in the inspector tab, allowing you to easily monitor its status and progress. Similar to Workers, you can select a Job, Alarm, or Wakelock to inspect its detailed information in the Task Details panel.
To view detailed information for a Worker, Job, Alarm, or Wakelock, you can select it in the Task Details panel on the right.
To learn more about the Background Task Inspector, see the following additional resources: