Cancelling scope of observation prevents restarting observation after creating new scope
See original GitHub issueAs reported on Slack, observation isn’t starting after a previous observation is cancelled (and remote peripheral is powered off and back on). Upon reconnecting, setCharacteristicNotification is not called to enable the observation.
Reproduction steps were said to be:
- Observe a characteristic.
- Cancel the scope of observation.
- Turn off the peripheral (hardware) and turn on it.
- Reconnect with the peripheral.
- Observe the characteristic again.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Use Kotlin coroutines with lifecycle-aware components
Any coroutine launched in this scope is canceled when the Lifecycle is destroyed. ... Create a new coroutine in the lifecycleScope
Read more >Unit test the new Kotlin coroutine StateFlow - Stack Overflow
To solve this issue you need to cancel the scope in which the collect is called, and as the scope of your test...
Read more >repeatOnLifecycle API design story | by Manuel Vivo - Medium
This API uses the LifecycleOwner 's lifecycleScope to trigger a new coroutine and call repeatOnLifecycle inside it.
Read more >Common mistakes when using Architecture Components
Don't use Fragment as a LifecycleOwner when observing Live Data. ... asStateFlow() fun fetchMovieData() { viewModelScope.launch ...
Read more >Kotlin Flows in Android summary - ProAndroidDev
To prevent the flow collection from suspending the current scope, ... collector is to cancel and restart it every time a new value...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’ve been running with and without this snapshot for the last 8 days and it definitely seems to fix both the issues described above. Thanks @twyatt for fixing and @francismariano for defining the issue! 🎉
Thanks for testing/validating the snapshot @ebabel! I’ve taken the PR out of draft.