简体   繁体   English

Android蓝牙扫描-如何知道何时完成?

[英]Android Bluetooth scan - how to know when it's finished?

I'm using the startScan method of a BluetoothLeScanner to collect information about available devices. 我正在使用BluetoothLeScannerstartScan方法来收集有关可用设备的信息。 However, I need to know when the scan has finished. 但是,我需要知道扫描何时完成。 There are no methods in the callback that seem to indicate this. 回调中似乎没有任何方法可以表明这一点。

How can I know when the scan has completed? 我怎么知道扫描何时完成?

You can use stopScan() when you complete the functionality for scanning devices. 完成扫描设备的功能时,可以使用stopScan()
So it is more like the scan completes when you want it to, depending on whether you would want the scan to stop based on a time criteria or say after a few devices are found. 因此,它更像是您希望在何时完成扫描,具体取决于您是希望基于时间标准停止扫描还是在找到一些设备后说停止扫描。

The decision point to do that would be ScanCallback functions and results . 这样做的决定点将是ScanCallback函数和结果
ScanResult can help. ScanResult可以提供帮助。

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

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