Skip to content Skip to sidebar Skip to footer

Receiving Bluetoothgattcallback Multiple Times After Foreground Service Restart

I am working with BLE enabled hardware and communicating with the hardware using Foreground Service of the Android. Foreground service is responsible for handling the BLE related e

Solution 1:

Don't set mBluetoothGatt = gatt in onConnectionStateChange. Instead set it from the return value of connectGatt. Otherwise you might create multiple BluetoothGatt objects without closing previous ones and therefore get multiple callbacks.


Post a Comment for "Receiving Bluetoothgattcallback Multiple Times After Foreground Service Restart"