I have a repository which holds the LiveData
object and is used by both Activity
and now it's needed in JobService
(From Firebase dispatcher) through a ViewModel
.
There is answer for plain Service
over here: Observe LiveData from foreground service
But it doesn't mention how to do the same for JobService
.
If you want to observe a LiveData object from something that isn't a LifecycleOwner, you can use the
observeForever
method.