Solution 1 :
The advertising packet is fixed at 31 octets and will contain a number of AD structures. Each AD structure shall have a Length field of one octet, which contains the Length value, and a Data field of Length octets. For service data that means about 20 octets of actual data.
Some common workarounds are:
- compress/encode the data that is sent
- Have a number of advertisements each with different data
- Use scan response
And of course, looking to the future, there will be Bluetooth 5 Extended Advertisements
Problem :
I’m trying to send a series of BLE advertisements from my Android app. Is there a way to use more of the 31-byte maximum for BLE advertisement packets for actual data? Currently, I can only use a maximum of 20 bytes for actual data. Here is my code for building the advertise data.
AdvertiseData advertiseData = new AdvertiseData.Builder()
.addServiceData(uuid,adv_packet)
.addServiceUuid(uuid)
.setIncludeTxPowerLevel(false)
.setIncludeDeviceName(false)
.build();
adv.startAdvertising(advertiseSettings, advertiseData, advertiseCallback);
Where adv_packet
can currently be a maximum of 20 bytes.
Is there a way I can increase this maximum?