mirror of
https://github.com/shuto-cn/RFID.git
synced 2026-02-01 00:00:03 +08:00
修复bug
This commit is contained in:
@@ -270,18 +270,16 @@ public class RfidPlugin extends CordovaPlugin {
|
||||
|
||||
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
|
||||
if (mBlueToothAddressList.indexOf(device.getAddress()) == -1) {
|
||||
mBlueToothAddressList.add(device.getAddress());
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("name", device.getName() == null ? "" : device.getName());
|
||||
object.put("address", device.getAddress());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mBlueToothArray.put(object);
|
||||
if (mBlueToothAddressList.indexOf(device.getAddress()) == -1) {
|
||||
mBlueToothAddressList.add(device.getAddress());
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("name", device.getName() == null ? "" : device.getName());
|
||||
object.put("address", device.getAddress());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mBlueToothArray.put(object);
|
||||
}
|
||||
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
Reference in New Issue
Block a user