A beacon “layout” refers to the beacon format, specifically how the different fields are encoded into bytes needed to transmit the information inside Bluetooth LE advertising packets.
Some companies like Apple maintain their beacon formats as trade secrets, so they don’t allow them to be published. Open source modules like the Android Beacon Library can’t include ways to decode these beacons without publishing them. So they use a layout string, which is a way for a user to quickly and easily tell the library to decode that beacon.
Here’s an example for the open-source AltBeacon format, which doesn’t mind folks publishing it:
m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25
This means that a bluetooth LE beacon transmission matching this layout can be encoded/decoded like this:
- Uses a manufacturer advertisement packet (m) with a two byte type code of 0xbeac in byte positions 2 and 3.
- Has its first identifier (ID1 equivalent to iBeacon UUID) in bytes 4-19.
- Has its second identifier (ID2 equivalent to iBeacon major) in bytes 20-21.
- Has its third identifier (ID3 equivalent to iBeacon minor) in bytes 22-23.
- The “p” and “d” parts of the layout refer to a “power” calibration value for distance estimates and a “data” field to store battery level and other manufacturer-specific information.
There are several other popular beacon formats like iBeacon and Eddystone. They have their own layout strings, which are both very similar to the one shown above.
While you can’t use different beacon formats interchangeably, you can use all these beacon formats on both iOS and Android. Using a proprietary format on Android is just a matter of doing a Google search to find the right layout string for the beacon format, then configuring it like this:
BeaconManager.getBeaconParsers().add( new BeaconParser().setBeaconLayout("<paste layout string here>"));