我遇到一些问题,需要连续运行多个扫描。以下是我处理行动的方式:
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
显然会经历某种过程,它会删除所有缓存的设备,但它永远不会再次启动扫描..任何人对此都有任何建议吗?