Search code examples
androidbluetooth-lowenergyibeaconads

How to set LE discoverable flag for ibeacon packet inside beacon class of android


I am using the beacon class (altbeacon.beacon.Beacon) which makes it possible to create an ibeacon advertisement packet.

However the packet differs in the first 3 bytes (advertisement flags, which should be 0x020106 according to the ibeacon standard, containing the flag 0x06 which stands for "LE general discoverable").

I did not find a way to set those bytes from within the beacon library. Is there a way to the set those flags?


Solution

  • The library's BeaconTransmitter class is based on Android's native BluetoothLeAdvertiser:

    https://developer.android.com/reference/android/bluetooth/le/BluetoothLeAdvertiser.html

    Unfortunately, that class provides no ability to configure the specific flags set in the advertising packet. As a result, you are left with the defaults you have seen.