don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
941 stars 601 forks source link

Use API level 33 BLE functions (read, write & events) #985

Open peitschie opened 9 months ago

peitschie commented 9 months ago

Introduced in API level 33: https://developer.android.com/reference/android/bluetooth/BluetoothGatt#writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic,%20byte[],%20int)

The previous writeCharacteristic method has been deprecated, and now carries this warning:

This method was deprecated in API level 33. Use BluetoothGatt#writeCharacteristic(BluetoothGattCharacteristic, byte[], int) as this is not memory safe because it relies on a BluetoothGattCharacteristic object whose underlying fields are subject to change outside this method.

peitschie commented 6 months ago

A good example of this implementation is at https://github.com/capacitor-community/bluetooth-le/pull/572

peitschie commented 6 months ago

Example code snippet in #997

peitschie commented 2 months ago

Also relates to https://github.com/don/cordova-plugin-ble-central/issues/1006