0

This question is related to the question "Bluetooth Peripheral ADVERTISE_FAILED_DATA_TOO_LARGE"

When you set up the AdvertiseData object in Android it is necessary to include a ParcelUuid which should be 16 bytes. Given that the packet size limit is 31 bytes, I should have 15 bytes leftover to include the device name in the AdvertiseData.

I have tested this and the limit on the device name is 8 bytes; go beyond that and you get the error "ADVERTISE_FAILED_DATA_TOO_LARGE". The simple solution (which was the answer in the issue at the link above) is just to setIncludeDeviceName(false) and be done with it; however, I would like to do the following:

bluetoothAdapter.setName(bluetoothAdapter.getName().substring(0, 8));

But 8 characters seems to short AND I think I would be programtically changing the bluetooth device name for all applications (this is probably a security flaw which will eventually be closed).

Two questions:

  • Where are my missing bytes? ...overhead?
  • Is it a bad idea to programtically change the bluetooth device name for all applications?

Thx.

Vincent Scheib
  • 17,142
  • 9
  • 61
  • 77
user2782
  • 358
  • 2
  • 18

0 Answers0