I created some Worker
classes. I would like to run a function on the Activity, after each worker was finished.
My plan was to use LocalBroadcastManager
, trigger an event from the Worker, and receive the event in the Activity. Unfortunately LocalBroadcastManager
is deprecated.
I cannot use LiveData
, because the worker may run in the background, as a periodic work, and I can not share the LiveData
instance between workers and activities. The works that I would like to observe are tagged, but if I use getWorkInfosByTagLiveData
, I get a List<WorkInfo>
after each update, and I have no idea, which item in that list was updated.