androidbluetooth-lowenergyandroid-bluetoothbluetooth-gattandroid-ble

Android BLE onCharacteristicChanged Not Triggering on Different Devices


I have developed an Android app in Java that connects to a BLE device and receives streaming messages. On my phone with API level 33, everything works well, and the onCharacteristicChanged callback is triggered with the streaming bytes as expected. However, when I test the app on other phone and tablet, onCharacteristicChanged is not triggered.

Is onCharacteristicChanged not supported on all devices or API levels? What could be causing onCharacteristicChanged to not be triggered on some devices? How can I fix this issue?

thank you!


Solution

  • i changed the method signature from:

    public void onCharacteristicChanged(@NonNull BluetoothGatt gatt, @NonNull BluetoothGattCharacteristic characteristic, @NonNull byte[] value) {}
    

    to:

    public void onCharacteristicChanged(BluetoothGatt gatt,BluetoothGattCharacteristic characteristic) {}
    

    now it works to me in different devices!