如何阅读UDID,专业,烽火未成年人在Android设备上?未成年人、烽火、设备、专业

2023-09-06 13:52:25 作者:因为医生不是你@

我想开发一个应用程序BLE为Android。

I am trying to develop a BLE application for Android.

时的任何方式,通过它我可以检测和读取UDID,专业,烽火小Android设备?

Is the any way through which i can detect and read UDID, Major, Minor of beacon on android devices?

我看了RadiusNetworks Android的ibeacon服务,但我不明白为什么:

I have read the RadiusNetworks android-ibeacon-service, but I can't understand why:

major = (256 * (0xFF & paramArrayOfByte[(i + 20)]) +
 (0xFF & paramArrayOfByte[(i + 21)]));

其中 paramArrayOfByte LeScanCallback byte []的scanRecord

推荐答案

在获得字节[] scanRecord BluetoothAdapter.LeScanCallback ,它将包括蓝牙LE标头,它可以是可变长度取决于iBeacon的类型。

When you get the byte[] scanRecord from BluetoothAdapter.LeScanCallback, it will include the Bluetooth LE headers, which can be variable length depending on the type of iBeacon.

由于可变长度的头四个字节表示一个iBeacon广告( 4C 00 02 15 )可以在任何地方开始从第三个字节( scanRecord [2] ),一直到第六个字节( scanRecord [5] )。在最新code ,在的Andr​​oid iBeacon库找到的 4C 00 02 15 在 scanRecord ,并称其为 startByte 。一切是在一个固定的位置,相对于 startByte

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 the 4c 00 02 15 within the scanRecord and calls it the startByte. Everything else is at a fixed position relative to that startByte.