views:

15

answers:

0

I can't connect to OBDKey sometimes . I use BluetoothChat example to connect to OBDKey. I can connect to it and read data, but sometimes socket is closed.

m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });

mmSocket = (BluetoothSocket) m.invoke(mmDevice, 1);

mmSocket.connect();

Before this OBDKey is paired succesfully. Why does socket close sometimes?