【发布时间】:2015-05-07 18:46:14
【问题描述】:
我正在尝试使用 MAC 地址连接到 BLE 设备。
BluetoothDevice device = bluetoothAdapter.getRemoteDevice(rememberedDeviceAddress)
bluetoothDevice.connectGatt(context, false, bluetoothGattCallback);
我在BluetoothGattCallback.onConnectionStateChange 中收到带有status = 133 和newState = 2 的回调即使我的BLE 设备已关闭。
newState = 2 指的是BluetoothProfile.STATE_CONNECTED,这意味着我已连接到设备并且状态 = 133 是 GATT_ERROR(而不是状态 = 0 成功)
我没有收到无法注册回调错误。
设备:一加一(Android 4.4)
有关可能导致此问题的任何指示都会有所帮助。
注意:问题并非在所有设备上都发生。在装有 Android 5.0 的 Nexus 5 上一切似乎都运行良好
请在堆栈跟踪下方找到:
03-06 13:00:11.994: D/BluetoothGatt(26771): registerApp()
03-06 13:00:11.994: D/BluetoothGatt(26771): registerApp() - UUID='uuid comes here'
03-06 13:00:12.004: D/BluetoothGatt(26771): onClientRegistered() - status=0 clientIf=5
03-06 13:00:42.004: D/BluetoothGatt(26771): onClientConnectionState() - status=133 clientIf=5 device='device id comes here'
【问题讨论】:
-
看看这个问题的建议答案:stackoverflow.com/questions/27280402/…
-
你能解决这个问题吗?我也有同样的问题。
标签: android bluetooth bluetooth-lowenergy android-bluetooth