AndroidSmoothBluetooth icon indicating copy to clipboard operation
AndroidSmoothBluetooth copied to clipboard

Problem to connect : no BluetoothService while connect method is called

Open remi-ollivier opened this issue 8 years ago • 0 comments

I read your source code to understand why it does not connect smoothly and I found that no BluetoothService is avalaible before you call connect(), but for the case of a server you don't have to need to search and try to pair to another device. The client has to connect to the server. Example : device1 is my server, device2 is my client. Device1 is visible, device2 tries to connect to device1 but it fails. We can repeat this operation several times it will always fail. But if device1 tries to connect to device2 it will work because both have called connect(), so both have already a BluetoothService instance. My solution is to add these lines

if (!isServiceAvailable()) {
            setupService();
}
startService(mIsAndroid, mIsSecure); 

in the end of the constructor, and it works correctly (I already tested it).

Hope it will help LAcrym0

remi-ollivier avatar Aug 18 '16 08:08 remi-ollivier