From 918bd3143292a487a52c6cf20a1477ea198d74f2 Mon Sep 17 00:00:00 2001 From: pedrodagraca Date: Thu, 11 Apr 2024 12:59:16 +0100 Subject: [PATCH] Return device alias Calls BluetoothDevice.getAlias() in order to have the custom name (alias) from bluetooth settings --- src/android/com/megster/cordova/BluetoothSerial.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/com/megster/cordova/BluetoothSerial.java b/src/android/com/megster/cordova/BluetoothSerial.java index 8be5575f..0b4bafd1 100644 --- a/src/android/com/megster/cordova/BluetoothSerial.java +++ b/src/android/com/megster/cordova/BluetoothSerial.java @@ -329,7 +329,8 @@ private JSONObject deviceToJSON(BluetoothDevice device) throws JSONException { JSONObject json = new JSONObject(); json.put("name", device.getName()); json.put("address", device.getAddress()); - json.put("id", device.getAddress()); + json.put("id", device.getAddress()); + json.put("alias", device.getAlias()); if (device.getBluetoothClass() != null) { json.put("class", device.getBluetoothClass().getDeviceClass()); }