Android BLE scanning not parsing ScanRecord on some devices

255 Views Asked by At

My problem is the that on some devices the ScanResult.getDevice() or ScanResult.getScanRecord() both return null on some Android devices but works fine on most. If I can't call getDevice() reliably how can I connect?

When I look at the toString of results in my onScanResult of the callback I do see a small difference between devices that work and do not.

This is the result string with a failing device.

{device=F1:6B:2E:01:43:88, scanRecord=ScanRecord [mAdvertiseFlags=5, mServiceUuids=null, mServiceSolicitationUuids=[], mManufacturerSpecificData={}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=MYDEVICE], rssi=-38, timestampNanos=10844927511936, eventType=27, primaryPhy=1, secondaryPhy=0, advertisingSid=255, txPower=127, periodicAdvertisingInterval=0}

This is the result string with a working device.

{device=F1:6B:2E:01:43:88, scanRecord=ScanRecord [mAdvertiseFlags=5, mServiceUuids=null, mServiceSolicitationUuids=[], mManufacturerSpecificData={}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=MYDEVICE, **mTDSData=null**], rssi=-65, timestampNanos=131383632077590, eventType=27, primaryPhy=1, secondaryPhy=0, advertisingSid=255, txPower=127, periodicAdvertisingInterval=0}

The one difference I noticed was that the failing device does not include mTDSData=null

Details of my setup:

  • nrf51422 BLE peripheral.
  • Compiling Android api 30 min api 23
  • Working device Moto G7 running Android 10 with Bluetooth 4.2
  • Failing device RCA 7" running Android 10 with Bluetooth 4.0
0

There are 0 best solutions below