how to unobserve a characteristic? #592
Unanswered
schultzjim
asked this question in
Q&A
Replies: 1 comment
-
Kable will automatically disable notifications for a characteristic when there are no more flow subscribers for a specific characteristic. For example: val observation = peripheral.observe(..)
val job1 = launch {
observation.collect { .. } // Kable will `setNotifyValue` w/ `true` since there is now at least 1 subscriber to the flow
}
val job2 = launch {
observation.collect { .. }
}
// some time later..
job1.cancelAndJoin()
job2.cancelAndJoin() // since there are no more subscribers, Kable will (under-the-hood) `setNotifyValue` of `false` for that characteristic here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to be able to unobserve a characteristic, specifically I need to be able to tell the bluetooth peripheral I'm connected to that I no longer want to be notified of changes.
This is how this is done on our iOS app in Swift (not using kable)
peripheral.setNotifyValue(false, for: someCharacteristic)
I don't see a way to do this using kable on Android.
Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions