On a Samsung nexus S OS (4.0.1) when I pair with another Bluetooth device it's pairing and connecting. Once Bluetooth is paired and then try to reconnect again then it is throwing IOException exception and phone will crash.
My Bluetooth code:
try{
mBluetoothAdapter.cancelDiscovery();
mmSocket = device.createInsecureRfcommSocketToServiceRecord(uuid);
mmSocket.connect();
}
catch(IOException e){
e.printStackTrace();
}
java.io.IOException: Service discovery failed
android.bluetooth.BluetoothSocket$SdpHelper.doSdp(BluetoothSocket.java:431)
android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:224)