# android

Shalom Halbert

08/16/2019, 3:27 PM
I've taken LiveData and databinding Observables for granted. Someone asked why I don't unsubscribe from Observing either, and I realized that I don't know. Tried finding an answer, but haven't found one. In our project, Observables and LiveData are used for databinding and observed from Fragments/Activities. Would love to know if I have implemented them wrong, or learn why unsubscribing isn't necessary.


08/16/2019, 3:31 PM
From android docs
Unlike a regular observable, LiveData is lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services. This awareness ensures LiveData only updates app component observers that are in an active lifecycle state

Mark Murphy

08/16/2019, 3:32 PM
The data binding generated code is responsible for observing and unsubscribing its own observers. If you have your own observers, independent of data binding, you are responsible for unsubscribing those. However, this does not have a lot to do with Kotlin.