Slide 29
Slide 29 text
BluetoothGattCallback
public class MyGattCallback extends BluetoothGattCallback {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
super.onConnectionStateChange(gatt, status, newState);
if(newState == BluetoothProfile.STATE_CONNECTED) {
// DON'T CALL THIS HERE!!!
gatt.discoverServices();
Log.d(TAG, "Callback on thread: " + Thread.currentThread().getName());
}
}
}
Practical Bluetooth Low Energy on Android - @ErikHellman / www.hellso!.se