简体   繁体   English

如何在Nexus 5上修复Android BLE SCAN_FAILED_FEATURE_UNSUPPORTED?

[英]How to fix Android BLE SCAN_FAILED_FEATURE_UNSUPPORTED on Nexus 5?

I'm having this onScanFailed error code on some devices (LG to be more detailed) when discovering BLE devices on android. 我在Android上发现BLE设备时,在某些设备上有这个onScanFailed错误代码(LG更详细)。 The code works as expected on another devices. 代码在其他设备上按预期工作。 How can i fix it? 我该如何解决?

I use BLE API 21+ and the following code to discover: 我使用BLE API 21+和以下代码来发现:

ScanSettings scanSettings = new ScanSettings.Builder()
            .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
            .setReportDelay(discoveryDelay)
            .build();

Here are the full sources: https://github.com/4ntoine/protobuf-ble-rpc/blob/hi-p/android/client/src/main/java/com/googlecode/protobuf/blerpc/BleRpcConnectionFactory.java#L362 以下是完整的资料来源: https//github.com/4ntoine/protobuf-ble-rpc/blob/hi-p/android/client/src/main/java/com/googlecode/protobuf/blerpc/BleRpcConnectionFactory.java# L362

Some devices do not support all of the features of the new LE API. 某些设备不支持新LE API的所有功能。 The features are hardware specific and up to the manufacturer to enable. 这些功能是特定于硬件的,并且由制造商决定。 The best approach is to check for the supported feature before building the filter and settings. 最佳方法是在构建过滤器和设置之前检查支持的功能。

bluetoothAdapter.isOffloadedFilteringSupported();

bluetoothAdapter.isOffloadedScanBatchingSupported();

I haven't found any issues with issuing filters when OffloadedFiltering isn't supported. 当不支持OffloadedFiltering时,我没有发现发布过滤器的任何问题。

If OffloadedScanBatching isn't supported, then you should not set a report delay. 如果不支持OffloadedScanBatching ,则不应设置报告延迟。 Attempting to set a report delay of anything other than 0 will result in an error. 尝试将报告延迟设置为0以外的任何内容都将导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM