bentalebahmed/BlueUnity

Error: IllegalThreadStateException when starting a new connection after closing a previous one in V3 plugin.

Closed this issue · 2 comments

Hi, currently when you start a new connection after closing a previous one you get:

StartConnection Error: IllegalThreadStateException

Looking into stackoverflow, it seems that the line #154 is the problem:

reader = new BufferedReader(new InputStreamReader(inputStream));
ReadDatathread.start();
UnityPlayer.UnitySendMessage("BluetoothManager", "ConnectionStatus", "connected");

I think that the solution is to create a new thread before running ReadDatathread.start();.

How to reproduce it

  1. Start a connection.
  2. Close the connection.
  3. Start a connection.

I ll test that and get back to you

Problem solved, please check the last update. Let me know if you face any further issues. thanks for your support.