diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothConnection.java b/escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothConnection.java index 3fa74a3..6c8858a 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothConnection.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothConnection.java @@ -61,7 +61,7 @@ public BluetoothConnection connect() throws EscPosConnectionException { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - UUID uuid = getDeviceUUID(); + UUID uuid = this.getDeviceUUID(); try { this.socket = this.device.createRfcommSocketToServiceRecord(uuid); @@ -80,13 +80,10 @@ public BluetoothConnection connect() throws EscPosConnectionException { /** * Get bluetooth device UUID */ - @SuppressLint("MissingPermission") protected UUID getDeviceUUID() { + // https://developer.android.com/reference/android/bluetooth/BluetoothDevice - "00001101-0000-1000-8000-00805f9b34fb" SPP UUID ParcelUuid[] uuids = device.getUuids(); - // https://developer.android.com/reference/android/bluetooth/BluetoothDevice - UUID sppUid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); - - return (uuids != null && uuids.length > 0) ? uuids[0].getUuid() : sppUid; + return (uuids != null && uuids.length > 0) ? uuids[0].getUuid() : UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); } /**