Android BLE 连接错误133

在bluedroid gatt_api.h文件中有定义
#define GATT_ERROR 0x0085
https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#constants_2

情形一:
多次重复连接,断开,连接,断开,再连接,就可能出现此错误
调用 disconnect()后,并没有调用 close()去释放资源。
有些手机一次最多只能处理6个连接
如果依次连接 A B C D E F G 7个设备, 不用close()释放资源,到第7个设备
也会报 133 通用错误

情形2:
connectGatt 时 没有使用 BluetoothDevice.TRANSPORT_LE 参数

解决方法3:

connectGatt调用时, autoconnect设置为false会加快连接速度, 但这也会导致, 30秒内还连接不上,就会到133

设备电量低,信号弱
两个设备距离远,信号也弱
这些都会导致133错误

重新connect
或者 重新scan, 再connect

Null out any references to this BluetoothGatt object.
清空所有对 BluetoothGatt的引用。

解决方法4:
关掉蓝牙,再开
关掉手机,再开

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注