I am trying to develop a BLE application for Android.
Is the any way through which i can detect and read UDID, Major, Minor of beacon on android devices?
I have read the RadiusNetworks android-ibeacon-service, but I can't understand why:
major = (256 * (0xFF & paramArrayOfByte[(i + 20)]) +
(0xFF & paramArrayOfByte[(i + 21)]));
which paramArrayOfByte
is LeScanCallback byte[] scanRecord
When you get the
byte[] scanRecord
fromBluetoothAdapter.LeScanCallback
, it will include the Bluetooth LE headers, which can be variable length depending on the type of iBeacon.Because of the variable length headers the four bytes that indicate an iBeacon advertisement (
4c 00 02 15
) may begin anywhere from the third byte (scanRecord[2]
) up to the sixth byte (scanRecord[5]
). In the latest code, the Android iBeacon Library finds the index position of the4c 00 02 15
within thescanRecord
and calls it thestartByte
. Everything else is at a fixed position relative to thatstartByte
.scanRecord
should be parsed as a list of AD structures.With nv-bluetooth, you can extract iBeacon like the following.
See "iBeacon as a kind of AD structures" for details.