I'm trying to implement an app using advertising BLE-Beacons in a similar way the existing automated contact-tracing apps do. But I need more than the normal 25 free bytes in the beacon layout.
Since Bluetooth 5 there should be the possibility to use extended advertisements with up to 255Bytes packet size (as described here: https://www.novelbits.io/bluetooth-5-advertisements/)
I've seen the extra-data-field, but it just supports long and I couldnt find documentation about it and if it really is what I'm searching.
So is there an option to use extended advertisements or do I need to implement it from scratch? If the extra-data-field is for extended advertisements it should be possible to transfer my data into bytes, then into long and do it backwards when reading it out, isnt it?
Thanks really much for your help
Sanny
CodePudding user response:
While Android 8 SDKs supports extended BLE 5.0 advertising packets with BluetoothDevice.PHY_LE_2M
, this will only work on devices with both hardware support and firmware drivers with 5.0 extensions.
The Android Beacon Library does not have any tools that allow advertising beacon packets or scanning beacon packets with extended lengths. The reasons are:
- Relatively few phone models have firmware support for BLE 5.0 extensions.
- No commonly used beacon formats use these extended packets.
That said, the library is extensible and can be augmented to offer these features for supported devices. If you can make a good case for adding these features and are interested in helping do the work, you may wish to open a feature request issue or proposed implementation pull request against the open source repo.