I wish to detect Eddystone Ul and uid without using Proximity Beacon API or Nearby Messages API. I wish to use native android libraries like BluetoothAdapter or BluetoothGatt or BluetoothGap to parse the eddystone frames. Is this feasible? if so how and If its not feasible then what could be the alternative?
All of Eddystone data is contained in the Bluetooth 4.0 ("Low Energy," "BLE") advertising packet, so no need for BluetoothGatt
or BluetoothGap
. Use the BluetoothLeScanner
instead. In the onScanResult
callback, you can access the advertising data via:
// assuming `result` is the ScanResult passed to the `onScanResult` callback
byte[] rawData = result
.getScanRecord()
.getServiceData(ParcelUuid.fromString("0000FEAA-0000-1000-8000-00805F9B34FB"));
Then, you will need to parse the bytes according to the Eddystone specs:
UID:
https://github.com/google/eddystone/tree/master/eddystone-uid
URL:
https://github.com/google/eddystone/tree/master/eddystone-url
There's also an example project included in the Eddystone repo, so you can probably start there, maybe reuse some code:
https://github.com/google/eddystone/tree/master/tools/eddystone-validator
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