Skip to content

Commit 8cb56e5

Browse files
authored
Update BluetoothConnection.java
1 parent a97f817 commit 8cb56e5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothConnection.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public BluetoothConnection connect() throws EscPosConnectionException {
6161

6262
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
6363

64-
UUID uuid = getDeviceUUID();
64+
UUID uuid = this.getDeviceUUID();
6565

6666
try {
6767
this.socket = this.device.createRfcommSocketToServiceRecord(uuid);
@@ -80,13 +80,10 @@ public BluetoothConnection connect() throws EscPosConnectionException {
8080
/**
8181
* Get bluetooth device UUID
8282
*/
83-
@SuppressLint("MissingPermission")
8483
protected UUID getDeviceUUID() {
84+
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice - "00001101-0000-1000-8000-00805f9b34fb" SPP UUID
8585
ParcelUuid[] uuids = device.getUuids();
86-
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice
87-
UUID sppUid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
88-
89-
return (uuids != null && uuids.length > 0) ? uuids[0].getUuid() : sppUid;
86+
return (uuids != null && uuids.length > 0) ? uuids[0].getUuid() : UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
9087
}
9188

9289
/**

0 commit comments

Comments
 (0)