'Android bluetooth scan (without LE) get informations from BluetoothDevice object
Is it possible to get informations such as minor, major and UUID (for iBeacon) in BluetoothDevice object with a Bluetooth scan (no LE) ?
private val receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val action: String = intent.action!!
when(action) {
BluetoothDevice.ACTION_FOUND -> {
// Discovery has found a device. Get the BluetoothDevice
// object and its info from the Intent.
val device: BluetoothDevice? =
intent?.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)
if (device?.name != null) {
Log.d("BLUTOOTHSCAN", "${device?.toString()}")
}
}
}
}
}
With BLE scan i can have them from ScanResult object :
fun manageResult(scanResult: ScanResult?) {
if (scanResult != null) {
val scanRecord = scanResult.scanRecord
val iBeaconManufactureData = scanRecord.getManufacturerSpecificData(...)
if (iBeaconManufactureData != null && iBeaconManufactureData.size >= 23) {
val resultBuffer = ByteBuffer.wrap(iBeaconManufactureData)
val uuidA = resultBuffer.getLong(2)
val uuidB = resultBuffer.getLong(10)
val uuid = UUID(uuidA, uuidB)
val major = resultBuffer.getShort(18)
val minor = resultBuffer.getShort(20)
...
My goal is to scan beacons without need for location permission.
Solution 1:[1]
No, they are two different radio technologies that were merely specified by the same organisation and therefore have a similar name.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Risto |
