-
Notifications
You must be signed in to change notification settings - Fork 48
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
can't start the connection manager after have been connected #22
Comments
Hi, Sorry for the late reply. Is there a reason you are not letting the You might want to try connecting without calling the pair and discovery functions before moving to the connection sequence. |
On some devices, the BluetoothSocket#isConnected method always returns "false". I had the same problem and it is also reported here (http://stackoverflow.com/questions/14792040/android-bluetoothsocket-isconnected-always-returns-false). Because of this, the plugin wont work on some devices. In my local version I write to the socket without checking its isConnected state, and handle exceptions afterwards. When disconnecting I set the socket back to null. |
Is there a list of which devices are affected by I'm currently in a situation where I do not have any equipment to test this plugin out on or develop reliably. I'll make a mention of this in the README in case someone is interested to fork and develop this plugin. |
Hi, |
@h2altitude How did you check that the BluetoothSocket#isConnected returns true properly ? look at the code here: When you are trying to start the connection manager, and the socket isConnected returns false, the error you are mentioning occurs. |
@tanelih here is my fork, with the changes applied: Not sure if you want me to make a pull request. I didn't test it extensively. I don't know of any list of the devices. It might be related to the fact that isConnected method was not present in lower API versions. |
@kozak Thanks for that! I took a quick look at it and didn't really see any weirdness with it. Make a pull request. 😃 I take it that in your fork it would mean that whenever the underlying |
@kozak i just tested the |
@tanelih I've made the pull request. Exactly, when the socket is not null, we assume its connected. We null it on disconnect() and read() failure. Any write or read on disconnected socket will cause an error as normal. @h2altitude best if you wait for tanelih, then remove your plugin and reinstall it. For a quick test you can do this:
|
Thanks for your contributions! The pull request is now merged. |
I have installed the plugin on phonegap CLI 3.0.0, and tried listing bluetooth devices, pairing and connecting sucessfully. Then when i try to start a managed connection, i have an error with the message "Socket has no active connection", and the code is 0, i don't know why.
I am making tests with an LG phone with android 4.1.2 and an Alcatel Pixi 2 with android 4.2
I have the SDK API 19 for building apk.
Here is a code snippet
The text was updated successfully, but these errors were encountered: