android 8.0上的BLE扫描 [英] BLE Scan on android 8.0

查看:155
本文介绍了android 8.0上的BLE扫描的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个应用程序,可以扫描附近的设备(周围有多种信标). 我正在使用具有CALLBACK_TYPE_ALL_MATCHES和一个空ScanFilter数组的BluetoothLeScanner进行扫描(因为我想获取附近所有设备的回调).

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).

我的应用在OnePlus 5设备Android 7.x(和其他一些设备)上运行良好-直到我在设备上升级到android 8.0 OTA.

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.

我不确定这是Android 8.0问题还是OnePlus Oxygen错误,但我遇到以下情况: 我周围有很多信标,有些标榜标准ibeacon/eddystone数据包,另一些标明自定义数据包.

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.

我仅收到标准ibeacon/eddystone数据包的回调(onScanResult),而没有收到自定义数据包的回调. 升级之前,我得到了所有类型数据包的回调-标准和非标准.

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.

在android 8.0中,接收到的ble数据包的下划线过滤器是否有所更改? 它是最新的Oxygen OS版本中的错误吗? 我应该添加某种标志来获取非标准数据包吗?

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.

推荐答案

在调查了每个信标发送的数据包之后,我发现一个自定义信标发送了一个数据长度字节错误的数据包. 这导致数据包被OS 8(Android或Oxygen)过滤掉-与旧版本无关.

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...

这篇关于android 8.0上的BLE扫描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆