Im doing bluetooth based application, I want to connect other devices like nokia devices, and printer.
I refer the android bluetooth documentation http://developer.a
You can do connection between two BT devices easily. You just need to call
createRfcommSocketToServiceRecord(UUID)
with UUID that understand receiver device. For file transfer action UUID must be equal (for example) to 00001106-0000-1000-8000-00805F9B34FB (File transfer service)
So you connection code might looks like code below
BluetoothDevice device = mBluetoothAdapter.getRemoteDevice("00:0A:94:16:77:A0"); BluetoothSocket clientSocket;
try {
log(TAG, "Remote device " + device);
ParcelUuid[] uuids = device.getUuids();
boolean isFileTransferSupported = false;
UUID ftpUID = UUID.fromString("00001106-0000-1000-8000-00805F9B34FB");
// Check if remote device supports file transfer
for (ParcelUuid parcelUuid: uuids) {
if (parcelUuid.getUuid().equals(ftpUID)) {
isFileTransferSupported = true;
break;
}
}
if (!isFileTransferSupported) {
log(TAG, "Remote bluetooth device does not supports file transfer ");
return;
}
clientSocket = device.createRfcommSocketToServiceRecord(ftpUID);
clientSocket.connect();
} catch (IOException e) {
return;
}