Android Developers
Published in

Android Developers

Background Task Inspector

Android Studio includes multiple inspectors, such as the Layout Inspector and Database Inspector, to help you investigate and understand the internal state of your running app. With Android Studio Arctic Fox, we are releasing a new inspector to help you monitor and debug workers your app schedules using WorkManager 2.5.0 or higher.

WorkManager is the recommended way to run asynchronous tasks in the background, even after the app is closed. Although it’s easy to configure your tasks as WorkManager workers, once a worker is queued, its execution is difficult to monitor and tricky to debug if you face issues.

With the Background Task Inspector, you can easily monitor the status of a worker, see its relationship with other chained workers, or inspect details, such as the worker output, frequency, and other timing information. Let’s see what the Background Task Inspector can do on a sample project.

To demo the Background Task Inspector, I’ll use the WorkManager sample app in architectural-components repo. If you want to give it a try, you can check out the repo and follow along as you read the article.

This app uses WorkManager to apply user selected filters on the selected photo. After running the app, users can choose a photo from the gallery or simply use a random stock photo. To see how the Background Task Inspector works, I run the app and select an image to apply some filters.

The app applies the selected filters on the selected image

Each filter is implemented as a WorkManager worker. After a short wait, the app displays the photo with the selected filters applied. Without any further knowledge on the sample app, let’s see what else I can figure out by just using the Background Task Inspector.

To open the Background Task Inspector, select View > Tool Windows > App Inspection from the menu bar.

View > Tool Windows > App Inspection

With the Background Task Inspector tab selected in the App Inspection window, I run the app again on a device or emulator running API level 26 or above. If it is not automatically selected, I choose the app process from the drop-down menu. After connecting to the app process, I can then go to my running app and select all filters and click apply. This time I can see a list of running jobs in the Background Task Inspector.

List of running jobs

The Background Task Inspector lists the class name, current state, start time, retries and the output data of all the running/failed or completed jobs. Clicking on a specific job from the list opens the work details panel.

Details Panel

This panel provides more detailed information for each worker’s description, execution, work continuation and the results. Let’s take a close look at each section.

Work Details

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


Next, the execution section shows the worker’s constraints (if any), running frequency, it’s state and which class created and queued this worker.


WorkContinuation section displays where this worker is in the work chain. You can check the previous or the next worker, if any, or the other jobs in the work chain. You can click to another Worker UUID to navigate and see the selected worker’s details. Looking at this work chain, I can see that the app uses 5 different workers. The number of workers may differ depending on the choice of filters by the user.

This is great but imagining the work chain is not always easy if you are not familiar with the app. Another great feature of Background Task Manager Inspector is the ability to display the work chain as a graph. To do that I click the ‘Show in graph’ link in the WorkContinuation section or switch to Graph View by clicking the ‘show Graph View’ button on top of the jobs list.

Graph View

This graph view can help you to understand the order of the workers, the data which is passed between workers and the current state of each worker.


The last section in the Work Details panel is the Results pane. In this section you can see the start time, retry count and the output data of the selected worker.

Let’s say I want to test what happens when a worker stops. To do that, I’ll run the app again, select the worker, wait until it changes to running state and click the ‘Cancel Selected Work’ on the top left. Once I do that, the worker I selected and the remaining workers in the chain change their status to canceled.

You can cancel any running worker

Graph view becomes even more useful if your app includes complex chaining relationships, such as the one here. The graph allows you to quickly see relationships between a complex set of workers and monitor their progress.

Here is some WorkManager art =)

If you want to try the Background Task Inspector with a more complex graph or make some WorkManager art, you can find the code here and add the DummyWorkers to the continuation object as seen here.

Background Task Inspector will be available with Android Studio Arctic Fox release but it is already available for you to try in the Arctic Fox Preview channel and soon will be in beta! If your app uses Work Manager, please give a try and let us know what you think or simply share your WorkManager art with us!




Articles on modern tools and resources to help you build experiences that people love, faster and easier, across every Android device.

Recommended from Medium

GetFlutter Now GetWidget Widgets of the Week

Creating Ship Thrusters

GC Animals: Health, feeding and extracts.

Android Phantom Widget ID(幽霊ウェジェットID)

Now GetFlutter is GetWidget


Why should we go with Kotlin app development?

Efficient Android Testing Using Raccoon And Espresso

How to test your In-app updates before releasing an Android app to production

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Murat Yener

Murat Yener

Code geek, Developer Advocate @Google

More from Medium

Exploring Jetpack WindowManager for Foldable Devices

Android Spotless Easy Setup

Exploring Android 13: Per-App Language Preferences