0

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?

1 Answers1

0

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:

  1. compress/encode the data that is sent
  2. Have a number of advertisements each with different data
  3. Use scan response

And of course, looking to the future, there will be Bluetooth 5 Extended Advertisements

ukBaz
  • 6,985
  • 2
  • 8
  • 31