首先,确保两个设备都已开启蓝牙并已连接到同一网络。其次,可以尝试使用以下代码片段来解决问题:
BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(address);
BluetoothGatt gatt = device.connectGatt(this, false, gattCallback);
gatt.connect();
以上代码会连接到指定的蓝牙设备并启动Gatt连接。如果问题仍然存在,可能需要考虑重新启动两个设备并再次尝试连接。