Skip to content

Problem to connect : no BluetoothService while connect method is called #6

Description

@remi-ollivier

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions