Search code examples
androidbluetooth-lowenergygatt

How to connect multiple BLE devices at the same time in android app


I am developing an android app for handling BLE devices. I need to connect two BLE device at the same time and read/write characteristics,services from/to the device at the same time. How can I do this? Is it needed separate GATT instance and callback for each device? How to do this?


Solution

  • It's very simple. Just execute connectGatt one time for every device, which will then give you one BluetoothGatt object per device. The callback object can be the same, or a separate instance per device, it's up to you, although I guess it's easier if you have one instance per device.