Mostly we directly use
LiveData. But sometimes we need more control like knowing if there are any active observers listening to changes in data, this is useful when you want to listen to location or sensor updates.
In this lesson, we will build an application which shows the value via the proximity sensor and also automatically updates the UI when the value changes in a life-cycle aware fashion by using
SensorLiveData class which extends
LiveData to achieve instant UI updates in life-cycle aware fashion.