我正在尝试从SamsungGalaxy S6和J7手机连接外部BLE设备(音频扬声器)。但randomaly为BLE设备断开了callabck (音频扬声器)在我们的代码库中来自SamsungGalaxy S6 / J7。我们的观察是来自Phone OS的断开回调。
请在下面找到我们的代码段。
代码
private final BluetoothGattCallback connectionCallback = new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
super.onConnectionStateChange(gatt, status, newState);
if (newState == BluetoothProfile.STATE_CONNECTED) {
// Devices is Connect
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
// Disconnect call ocuur frequently from Phone(Samsung s6/s7). No such call should come from other phone.
}
}
为什么三星Galaxy S6 / J7发送BLE断开回调onConnectionStateChange()?