问题
I've developed an app that do ble scan for nearby devices (multiple kinds of beacons around). I am scanning using the BluetoothLeScanner with CALLBACK_TYPE_ALL_MATCHES and an empty ScanFilter array (since I want to get callbacks for all nearby devices).
My app was working just fine on my OnePlus 5 device Android 7.x (and few other devices) - until I have upgraded to android 8.0 OTA on my device.
I am not sure if it is Android 8.0 issue or OnePlus Oxygen bug but I face to following situation: Around me there are many kinds of beacons, some advertise standard ibeacon/eddystone packets and others advertise custom packets.
I receive callbacks (onScanResult) only for the standard ibeacon/eddystone packets and not for the custom ones. Before upgrading I got the callbacks for all kind of packets - standard and non-standard.
Was something changed in the underline filter of received ble packets in android 8.0? Is it a bug in latest Oxygen OS version? Should I add some kind of flag to get non standard packets?
Any idea will be much appreciated. Thanks.
回答1:
After investigating the packets sent by each beacon, I have figured out that one of the custom beacons sent a packet with wrong data length byte. That caused the packet to be filtered out by OS 8 (Android OR Oxygen) - did not matter to older versions.
Now i'll have to talk to the firmware company for a fix...
来源:https://stackoverflow.com/questions/48286314/ble-scan-on-android-8-0