observe

fun observe(characteristic: String, interval: Long = 5000, owner: LifecycleOwner? = null, callback: OnCharacteristicValueChangeCallback<ByteArray>)

Observe a given characteristic

Parameters

characteristic

The characteristic to observe

callback

The lambda to be called whenever a change is detected

interval

Optional only used for characteristics that doesn't have the NOTIFY property, define the amount of time to wait between readings

owner

Optional only used for characteristics that doesn't have the NOTIFY property, define the lifecycle owner of the legacy observer really useful to avoid memory leaks

See also

If the characteristic does not contain property BluetoothGattCharacteristic.PROPERTY_NOTIFY it will try to poll the value