This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Android BLE scanning not parsing ScanRecord on some devices.

My problem is the that on some devices the ScanResult.getDevice() or ScanResult.getScanResult() both return null on some devices but works fine on most.

This is probably more of an Android issue but thought I would see if anyone faced similar issues.  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 with s310 dual Ant BLE stack.

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 

Parents
  • Hi,

    I checked with our application team, their tip is to check the advertisement packet and make sure they do not have any additional zeroes or anything. I.e. make sure the length of each field is correct. Seems android validates the data before sending it to the app.

    It could be an idea to capture a sniffer log to see how the advertisement packet looks.

Reply
  • Hi,

    I checked with our application team, their tip is to check the advertisement packet and make sure they do not have any additional zeroes or anything. I.e. make sure the length of each field is correct. Seems android validates the data before sending it to the app.

    It could be an idea to capture a sniffer log to see how the advertisement packet looks.

Children
No Data
Related