The description of BluetoothLeAdvertiser over here says:
This class provides a way to perform Bluetooth LE advertise operations, such as starting and stopping advertising. An advertiser can broadcast up to 31 bytes of advertisement data represented by AdvertiseData.
Does this mean that I can decide on what every single byte of the entire 31 bytes can contain? If yes, how? The methods listed in AdvertiseData.Builder are addManufacturerData, addServiceData and addServiceUuid which aren't useful in my case.
Thanks
AFAIK you can not add the data directly, thus you need to use the API to add the data. Then to save space you should set setIncludeDeviceName setIncludeTxPowerLevel both to false.
Then if you want to use craracteristics, etc. i.e. you want to make the BLE peripheral to provide additional data, and not just to be a beacon. Then you must include the flags in the scan record. Flags will need take the normal parts i.e type+lenght+data, thus it takes 3 bytes. If you are ok with just beacon, then you'll save the 3 bytes to be used with your own data.
I would assume that Service data will require some service UID to be added, so I would assume it takes space, and sofor the best option to use is the manufacturer data.
Manufacturer data takes the normal bytes for type & lenght, additionally android devices do appear to automatically add the manufacturer data, which takes additional 2 bytes.
So, for simple beacons, you could indeed have 31-4 = 27 bytes of payload delivered via the scan record.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With