androidbluetoothbluetooth-lowenergy

New `onCharacteristicRead` method not working


after an embarrassing amount of time I have just found out that the new recommended receiver for onCharacteristicRead in BluetoothGattCallback as seen in the Android Developers reference:

public void onCharacteristicRead (BluetoothGatt gatt, 
                BluetoothGattCharacteristic characteristic, 
                byte[] value, 
                int status)

doesn't receive any data when I call readCharacteristic on the service. However, the deprecated one (Google Developers) does in fact receive the callback.

I have been following all the steps in the official guide, but trying to implement the new methods, and this is the only one so far that doesn't work in the "new callbacks".

Any ideas on how to fix this? I will use the deprecated method, but that's not something I'm keen on. Thanks in advance.


Solution

  • The new api's are only available as of Android 13.

    So

    After that, it shouuld work. At least it did for me...