mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-02-07 07:44:27 +01:00
Unregister capabilities callback before disconnection.
This commit is contained in:
@@ -215,13 +215,14 @@ class ChannelSoundingManager @Inject constructor(
|
||||
rangingSession = null
|
||||
_rangingData.value = null
|
||||
// unregister the callback
|
||||
|
||||
rangingManager?.unregisterCapabilitiesCallback(rangingCapabilityCallback)
|
||||
// Invoke the onClosed callback after a short delay to ensure the session is closed
|
||||
onClosed?.let {
|
||||
_rangingData.value = RangingSessionAction.OnStart
|
||||
// Wait for a moment to ensure the session is properly closed before invoking the callback
|
||||
// Launch a coroutine to delay and call onClosed
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
delay(500)
|
||||
delay(1000)
|
||||
it()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user