我在连续运行不止一次扫描时遇到了一些问题。这是我处理动作的方式:
if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)){
Log.w("Bluetooth", "SCAN STOPPED EVENT");
try{
mBluetoothAdapter.startDiscovery();
}catch(Exception ex){
Log.w("Bluetooth", ""+ex);
}
}
扫描后,我得到以下日志输出。在此示例中,扫描发现了 5 个设备。
(main) [1,17346] SCAN STOPPED EVENT
(524): mDeviceProperties size is 5
(524): mCache size is 5
(524): trying to delete object
(524): trying to delete object
(524): trying to delete object
(524): trying to delete object
(524): trying to delete object
(524): Deleting object00:AA:DD:FF:AA:44
(524): Deleting object77:DD:22:66:99:44
(524): Deleting object00:00:88:99:22:77
(524): Deleting object77:CC:33:CC:33:FF
(524): Deleting object66:33:44:00:33:88
(524): mDeviceProperties size is 0
(524): mCache size is 0
它显然正在经历某种过程,它会删除所有缓存的设备,但它永远不会再次开始扫描..有人对此有什么建议吗?