Closed chen-fuhai closed 2 years ago
I/MainActivity: onResume: 4D:57:4B:5A:59:42 D/BluetoothAdapter: isEnabled D/BluetoothAdapter: startLeScan(): null D/BluetoothAdapter: 748199934: getState(). Returning 12 D/BluetoothAdapter: 748199934: getState(). Returning 12 D/BluetoothAdapter: 748199934: getState(). Returning 12 D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=4 I/ApiConfig: onScanStarted: true I/MainActivity: onScanStarted: D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 I/ApiConfig: onLeScan: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 I/ApiConfig: onLeScan: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 I/ApiConfig: onLeScan: 41:47:53:4A:53:58
检查 定位权限和蓝牙权限 多自测,蓝牙这个主从机模式,很难说谁一定是对的. 多添加几个对照组设备,我遇到过 华为手机可以搜索到,小米就搜索不到,后来板子改代码就好了
你可以默认搜索,找到就用 断开就走回调断开。 当一个设备太频繁的时候 Android这边会把你踢掉。板子那边会出现卡死的情况
I/MainActivity: onResume: 4D:57:4B:5A:59:42 D/BluetoothAdapter: isEnabled D/BluetoothAdapter: startLeScan(): null D/BluetoothAdapter: 748199934: getState(). Returning 12 D/BluetoothAdapter: 748199934: getState(). Returning 12 D/BluetoothAdapter: 748199934: getState(). Returning 12 D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=4 I/ApiConfig: onScanStarted: true I/MainActivity: onScanStarted: D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 I/ApiConfig: onLeScan: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 I/ApiConfig: onLeScan: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 D/BluetoothDevice: mAddress: 41:47:53:4A:53:58 I/ApiConfig: onLeScan: 41:47:53:4A:53:58