The following is the first few sections of a chapter from Android's Architecture Components, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


WorkManager

Hardly a year goes by anymore without some new solution for doing background work becoming available for Android developers. In some cases, the new solution is designed to make things easier. In some cases, the new solution is designed to work around platform-imposed limitations (a.k.a., “The War on Background Processing”).

The new solution for 2018 is WorkManager, and preliminary indications are that it will be Google’s “go-to” solution for many background work scenarios.

WorkManager is considered to be part of the Architecture Components, despite having only loose connections to the rest of the Components. WorkManager does offer ways to monitor work via LiveData, for cases where the work happens to be going on while your UI is still visible.

In this chapter, we will explore WorkManager, its role, and how to employ it.

NOTE: At the time of this writing, WorkManager is in an alpha state. Do not use this for production code, and do not be surprised if updates to WorkManager change the API.

Where Should We Use WorkManager?

WorkManager is designed for “deferrable” work — work that you need to have done but does not have to happen right away. This includes the possibility that the work will be done sometime after your current process has terminated.

In this respect, WorkManager behaves akin to JobScheduler, which is the main engine behind WorkManager for API Level 23+ devices.

Where Should We Not Use WorkManager?

The preview of this section was stepped on by Godzilla.

WorkManager Dependencies

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.

Workers: They Do Work

The preview of this section left for Hollywood to appear in a reality TV show.

Performing Simple Work

The preview of this section is in an invisible, microscopic font.

Work Inputs

The preview of this section is en route to Mars.

Constrained Work

The preview of this section is unavailable right now, but if you leave your name and number at the sound of the tone, it might get back to you (BEEEEEEEEEEEEP!).

Tagged Work

The preview of this section is being chased by zombies.

Monitoring Work

The preview of this section apparently resembled a Pokémon.

Canceling Work

The preview of this section was fed to a gremlin, after midnight.

Delayed Work

The preview of this section was fed to a gremlin, after midnight.

Parallel Work

The preview of this section was last seen in the Bermuda Triangle.

Chained Work

The preview of this section is being chased by zombies.

Periodic Work

The preview of this section was stepped on by Godzilla.

Unique Work

The preview of this section was lost in the sofa cushions.

Testing Work

The preview of this section is in the process of being translated from its native Klingon.