Tracking WorkManager's Progress

Get status updates from WorkManager.

When you need visibility into WorkManager's progress, use LiveData. First, get an instance of WorkManager and call getWorkInfoByIdLiveData, passing in the downloadPodcasts variable.

WorkManager.getInstance().getWorkInfoByIdLiveData(downloadPodcasts.id).observe(this, Observer { status ->

 })

Once we're inside the Observer, do a quick null check:

            if (status != null) {

            }

If everything is good, see if the state is SUCCEEDED.


                if (status.state == WorkInfo.State.SUCCEEDED) {
                    d("daniel", "thank goodness, it's done! :)")
                }

More Tutorials

Build a Ridesharing Android App - Part 1

Getting started is sometimes the hardest part.

setOnClickListener

Add a click listener in Kotlin.

Android Login Layout

Let users sign in.