-
Notifications
You must be signed in to change notification settings - Fork 571
onDeviceConnected() method not reached in auto connect mode #10
Comments
Ahh. This is my fault to use BluetoothConnectionListener in auto connection mode. I will fix this problem. Thank you! |
Hi, I was just going to report on this and I found this thread... +1! I would be happy also to provide the fix, but I have two or three options and would like to know which one you prefer:
Does it sound right? Methods 1 and 3 should be pretty straightforward. I can provide you with a Pull Request if you are interested. |
BTW, I think onAutoConnectionStarted() is not really useful, since it's predictable and not "delayed" to be a callback method. Anyway, just saying. |
I now used the BluetoothStateListener to check the connection state. I also think onNewConnection() is not useful. I would prefer the solution you just described and which is not backward compatible. |
Mmmm maybe this is not such a great idea. I tried it in my app, and it gets very confusing because Connect and AutoConnect callbacks are different (and one overwrites the other). I think the only solution that makes sense is actually the second, but with a different concept: there should be a manual callback (BluetoothConnectionListener, defined by the user) and an automatic/transparent callback (also BluetoothConnectionListener, only set/unset when AutoConnect is active/inactive) that would take precedence and call the first after finished. I hope it makes sense. Will work on a PR soon enough. |
Hi, I set a BluetoothConnectionListener (setBluetoothConnectionListener(new BluetoothConnectionListener()) in auto connect mode. How do I detect when a device is connected? The BluetoothConnectionListener doesn´t work in this case?
The text was updated successfully, but these errors were encountered: