kable
kable copied to clipboard
Bluetooth Permissions Modal shows prematurely
Reported internally:
Current behavior: BLE permissions pop up shows up on initial app start Expected behavior: BLE permissions pop up appears at appropriate point in pairing flow
I've tracked the issue down to CBCentralManager initialization in Kable in the CentralManager class. It seems that initialization–itself–is enough to trigger the prompt. I deleted all usages of the local cbCentralManager and did not provide a delegate in the init, so it doesn't happen when the manager is used–happens right when it's init'd. What's weird is that this isn't the behavior in iOS. I can initialize a CBManager natively without being prompted.
Was wondering what @twyatt and @davidtaylor-juul 's thoughts are on this? Based on my findings, a reasonable solution would be to find a way to defer the initialization, but I thought there might be something I'm missing? Or maybe a better solution?
I think we should investigate further the discrepancy between natively initializing (and no prompt) vs initializing in this library and having an immediate prompt.
@Phoenix7351 it'd be great to get a sample iOS app in the SensorTag sample app (it has been requested); if you have the time/bandwidth?
With iOS support in the SensorTag sample, then it would give me a nice simple repro to be able to easily investigate this issue.
@Phoenix7351 it'd be great to get a sample iOS app in the SensorTag sample app (it has been requested); if you have the time/bandwidth?
With iOS support in the SensorTag sample, then it would give me a nice simple repro to be able to easily investigate this issue.
Agreed, but, yeah, really don't have the bandwidth for it at the moment. It might be helpful to checkout my CA-2008 branch? I did a lot in there to stub out things to eliminate them as potential causers of this issue. In that branch you can bring in/comment out the CBCentralManager to replicate the behavior. That might be helpful to start?
It just occurred to me that the issue is probably not having the iOS app side setup. I can help you with that!
https://medium.com/@adrianwitaszak/kotlin-multiplatform-mobile-bluetooth-permission-and-bluetooth-service-setting-9a697e70700
This article makes no mention of this behavior, but also instantiates CBCentralManager
lazily.