-
Notifications
You must be signed in to change notification settings - Fork 589
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
Discovery service fails after bluetooth turn off/on #45
Comments
Hello, |
I see. Also some more information. The weird thing is that in |
I have tried to reproduce the issue today on Motorola XT1030 but apparently switching off the BluetoothAdapter while Could you paste the code you are using and which mobile phone model? Apparently it would be best to make the library fail any connections that are in the process of establishing if the BluetoothAdapter will go off. |
I see, but did you try to connect again after turn off/on with device being discoverable? Because my problem is that when Bluetooth turns on I call I am using Nexus 6P, Android N Preview 4
This is the code. |
I don't see if you're unsubscribing the first connection (started before the off/on switch) and you shouldn't be able to call on the same device It would be great to see the logs from the library (use You could also describe when do you unsubscribe from the first connection. |
I am calling unsubscribe but I did not include the whole snippet. I am listening to the adapter on/off and unsubscribing appropriately. Also I unsubscribe when I finish reading from the device. I am using latest code commited in this repository. When I was debugging (I included library source into my project) the code worked?!?!?, services got discovered. I also found a way to simulate this by not turning on/off the adapter:
Basically inside So at the moment I managed to fix this with the folling code inside
Maybe there is a better solution to this problem. I have attached logs.logs.txt |
…ect=true` flag and before connection being established the `BluetoothAdapter` switched off. Summary: Related: #45 Reviewers: michal.zielinski, pawel.urban Reviewed By: michal.zielinski, pawel.urban Differential Revision: https://phabricator.polidea.com/D1699
What do you refer to when saying |
Actually last SNAPSHOT was from May since there was a styling issue which prohibited pushing to the maven repo. There is a new SNAPSHOT available since yesterday now. |
Summary
My current situation is that I have connected to device with autoconnect flag set. Which means I am waiting for the device to appear in order to connect. When I turn off/on bluetooth I establish again the connection. When the device becomes visible it connects but it hangs on discover services. I have done some debugging with nrf Connect and discover services returns true. Also I debugged RxAndroidBle and
RxBleRadioOperationServicesDiscover
operation returnstrue
frombluetoothGatt.discoverServices()
. HoweveronServicesDiscovered
is never called insideRxBleGattCallback
. If I clear the app and open again then it immediatelly connects. I am still looking what might be wrong but no solution so far.Preconditions
Connect with auto connect flag needs to be established.
Steps to reproduce actual result
Actual result
Discover services hangs
Expected result
Connection proceeds with
onServicesDiscovered
callback firedDo you maybe have any ideas what I might be doing wrong?
Thanks!
The text was updated successfully, but these errors were encountered: