I am new to android development. I want to send data using Bluetooth but the following exception coming.
Connecting To Bluetooth Failed.
java.io.IOException: [JSR82] connect: Connection is not created (failed or aborted).
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:397)
odacPkg.odac.BluetoothCommunication.run(CommunicationActivity.java:493)
Following is my source code.
final UUID applicationUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
btDevice=bluetoothAdapterObj.getRemoteDevice(deviceMAC.toUpperCase());
try {
BluetoothSocket btSocket = btDevice.createRfcommSocketToServiceRecord(applicationUUID);
btSocket.connect();
OutputStream outStream = btSocket.getOutputStream();
outStream.write(sendData);
btSocket.wait(CommunicationActivity.PACK_TIMEOUT);
InputStream inStream = btSocket.getInputStream();
inStream.read(receiveData);
outStream.flush();
outStream.close();
outStream.close();
}
catch (Exception e) {
}