I am having an issue where when I call sock.connect() it just hangs indefinitely. There is no exception and no timeout.
try
{
Method m = dev.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
sock = (BluetoothSocket) m.invoke(dev, 1);
sock.connect();
Thread.sleep(100);
in = sock.getInputStream();
out = sock.getOutputStream();
}
catch(ConnectTimeoutException ex)
{
return false;
}
catch(IOException ex)
{
return false;
}
catch(Exception ex)
{
return false;
}
The reason is that another app is using the bluetooth device already. I am trying to make my connection fail and at least throw an exception or something to let me know the device is already in use by another app.
Any other suggestions to approaching this?
Thanks.