I use standard API procedures to connect to the device. In particular, Bluetooth adapters OBDII.
I have two bluetooth OBDII adapters, different models. By running the same code, the first ones will be steamed and connected without problems to each tested phone / tablet. The second will connect and connect perfectly, except for my Nexus 7, which works with Android 4.2
It throws an IOexception: read failed, socket might closed or timeout, read ret: -1
I thought that it was something wrong with the device itself or with a later release ... But then another piece of “torque” software can connect to any adapter from my Nexus 7.
So, I am clearly doing something wrong / different, this is only a problem in a later OS.
Any help on this would be appreciated.
public void run() {
Log.i(TAG, "BEGIN mConnectThread");
setName("ConnectThread");
mAdapter.cancelDiscovery();
try {
mmSocket.connect(); <=**This is where the exception is thrown
} catch (IOException e) {
Etype = "Connection to: " + mmDevice.getName() + " at: "
+ mmDevice.getAddress() + " failed: " + e.getMessage();
connectionFailed();
try {
mmSocket.close();
} catch (IOException e2) {
Log.e(TAG, "unable to close() socket during connection failure", e2);
}
BluetoothChatService.this.start();
return;
}
source
share