Код: Выделить всё
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
Вот мой код:
Код: Выделить всё
static UUID uuid = UUID.fromString("00000000-0000-1000-8000-00805f9b34fb");
private BluetoothAdapter btAdapter = null;
private BluetoothSocket btSocket = null;
private Set pairedDevices;
Код: Выделить всё
btAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice btDevice = btAdapter.getRemoteDevice(address);
ParcelUuid[] supportedUuids = btDevice.getUuids();
if (supportedUuids != null)
{
for (ParcelUuid sUuid : supportedUuids)
{
Log.d("UUID", sUuid.toString());
}
uuid = supportedUuids[0].getUuid();
}
btDevice.createBond();
btSocket = btDevice.createRfcommSocketToServiceRecord(uuid);
btAdapter.cancelDiscovery();
btSocket.connect();
Подробнее здесь: https://stackoverflow.com/questions/785 ... -one-speci