LiveData observer does not trigger when a callback is emitted. But if I put the observable data in a function and change the data it works just fine. Please any ideas what would it be?
fun connect(address: String){
protocolARC.value = ProtocolARC() //OKAY!!!!
bleManager.gattClient.onCreate(getApplication(), address, object : GattClient.OnCounterReadListener {
override fun onCounterRead(value: Int) {
Log.d("HURRAY", "read")
protocolARC.value = ProtocolARC() //NOT OKAY?????
}
override fun onConnected(success: Boolean) {
stopScan()
}
})
}
The problem was in a callback. It was not being triggered from the main thread.