-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start scanning every time Bluetooth gets .poweredOn #283
Comments
Hey @troupmar, thanks for using our library! First When bluetooth will be turned on then |
Hi @paweljaneczek, firstly thank you for your comment. It helped me to clarify how the whole chain of commands work. However, I haven't still solved the
I start the app with bluetooth turned off. Then I turn it on. The scanning starts. Then I turn it off again. This is the console output:
I think the problem is that when I turn the bluetooth off, Could you recommend any way I could achieve desired behavior without getting the Thank you so much for your reply, I really appreciate it. |
It looks like it is a bug in our library. We shouldn't call Thanks for pointing out that issue! |
Thank you for the explanation and the fix! Great job with the library by the way 👍 |
Since it is resolved and fix was introduced I will close issue. |
Hello there,
I need to be scanning for peripherals all the time when Bluetooth is .poweredOn. Thus I only need to cancel scanning when Bluetooth gets turned off (or when the app is quit by a user).
Firstly I used Core Bluetooth only to achieve this and all worked as expected:
Then I wanted to make it more reactive thus I used this framework trying to achieve the same behavior with following code:
Let's assume I start the app with Bluetooth turned on. Scanning works as expected. Then I turn the Bluetooth off and I get following message from Core Bluetooth:
After that, I turn the Bluetooth back on and the scanning does not work anymore (I mean new scanning should be started). I do not even receive that Bluetooth state changed (via centralManager.observeState()). As I understand, when I turn the bluetooth off, I receive an error via the scanning observable, which should cancel the observable. I can see in code that when disposing the observable, stopScan() is called. So I assume scanning should be stopped automatically when bluetooth is turned off.
I believe the code snippets using Core Bluetooth vs. using RxBluetoothKit are similar and should have similar behavior (am I missing something?). I am new to this so I am sorry if it is something trivial I should know how to use. However, I followed the documentation when writing the code.
The text was updated successfully, but these errors were encountered: