【发布时间】:2014-06-03 21:46:34
【问题描述】:
我正在尝试使用 Android 的低功耗蓝牙与 BLE 设备进行通信。第一次连接时,一切正常(连接到 GATT 服务器正常,发现所有服务和特性等)但是,如果我断开连接并尝试重新连接,它将连接到 GATT 服务器,但不会能够发现服务。我必须杀死应用程序并重新启动它,有时即使这样也不起作用。
这是我用来断开设备连接的代码:
public void close(View view) {
if (mBluetoothGatt == null) {
return;
}
mBluetoothGatt.close();
mBluetoothGatt = null;
}
断开连接时我还需要做什么吗?似乎有一些资源仍处于连接状态,当我尝试重新连接时会阻止发现服务。
【问题讨论】:
标签: android bluetooth bluetooth-lowenergy android-bluetooth