From my understanding of what documentation means, you cannot startLeScan () and startDiscovery () works at the same time. The reason may be that there is only one BluetoothAdapter object (an object representing local Bluetooth equipment), so it cannot perform two different operations that use the BluetoothAdapter at the same time. (If someone knows something else regarding how he works in the background, let us know)
startLeScan () -> scan only for BLE devices
startDiscovery () → detects all Bluetooth devices, it also scans for only 12 seconds, and this cannot be changed (read the method description)
Note. . After scanning the startDiscovery () request when a BT device is found, you can get the device type to determine what each device is. For example:
int deviceType = device.getType(); if(deviceType == BluetoothDevice.DEVICE_TYPE_CLASSIC) { } else if(deviceType == BluetoothDevice.DEVICE_TYPE_LE) { } else if(deviceType == BluetoothDevice.DEVICE_TYPE_DUAL) { } else if(deviceType == BluetoothDevice.DEVICE_TYPE_UNKNOWN) { }
Kiki
source share