When extending BluetoothGattCallback should implementors invoke super methods?
Example:
public void onCharacteristicWrite(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status) {
// Is this needed?
super.onCharacteristicWrite(gatt, characteristic, status);
...
}
In this case it seems unnecessary to call super methods.
BluetoothGattCallback class is abstract and all its methods are empty.
Edit:
BluetoothGattCallback is part of Android SDK and above the native layer.
It's methods are called from BluetoothGatt class which handles callbacks from the native layer and converts them into calls to BluetoothGattCallback methods.
If you wonder why BluetoothGattCallback is an abstract class with empty implementations and not an interface. It's probably because it has too many callback methods, so implementing an interface would cause an unnecessary bloat in the code.
Edit2:
Official reference for this is little difficult to get. Compatiblity definition for hardware manufactures declares that they must implement Android APIs in the form declared in Android SDK.
Note that the underlaying native layer is connected via Android's Binder mechanism.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With