AltBeacon / spec

AltBeacon Technical Specification
http://altbeacon.org
208 stars 34 forks source link

Background Beacon data is broken? #27

Closed 5d closed 9 years ago

5d commented 9 years ago

AltBeacon is great, thanks for the work.

But I am facing a problem that the foreground beacon data is good, but when app goes to background the beacon data is kind of broken.

Here is my test result, the test device is an iPad App and using AltBeacon.

when the App is foreground, the beacon detail is like this:

and after the App go to background, the beacon detail:

BTW, the service table is unbroken.

So, did I miss to setting something or Apple changed the BLE beacon data at system level?

davemradnet commented 9 years ago

Hi, I can't speak to the code, but the data provided in the data tables are not conforming to the AltBeacon spec. Here's how the data tables provided differ from the AltBeacon spec

First data table:

Bytes 0-2: AD Flags, valid but are not part of the AltBeacon spec

Byte 3: Length. AltBeacon spec: 0x1B, but your data shows 0x11 Byte 4: Type of BLE Data Packet. AltBeacon Spec 0xFF, but your data shows 0x07.

According to the Bluetooth Low Energy Numbering, 0x07 is a complete list of 128 bit service Class UUIDs. This means that the next 16 bytes should be interpreted as a service UUID (which is not the same as an AltBeacon UUID).

I'm not sure how to interpret the remaining bytes as they don't conform to AltBeacon or as a 128 bit service class UUID (the data extends past what the length byte specifies)

Second data table:

Bytes 0-2: AD Flags, valid but are not part of the AltBeacon spec

Byte 3: Length. AltBeacon spec: 0x1B, but your data shows 0x14 Byte 4: Type of BLE Data Packet. Valid (0xFF - Manufacturer Data follows) Bytes 5-6: Manufacturer ID. Your data is showing an Apple Manufacturer ID, but Apple doesn't manufacture any devices using the AltBeacon spec (they use iBeacon).

The subsequent bytes are invalid.

Hope this helps in resolving the issue.

davidgyoung commented 9 years ago

Another important point is that iOS does not provide callbacks to apps in the background for manufacturer advertisements. This means that transmissions like AltBeacon can only be picked up when an app is in the foreground on iOS.

5d commented 9 years ago

@davemradnet, thanks for your detailed analysis, since I am using the thrid-party AltBeacon SDK to broadcast the AltBeacon, I don't really know how the beacon data is formatted, I'll investigate about this later.

@davidgyoung thank you, this is the answer I am waiting for.