Writing data on the characteristic

The last topic of this section deals with writing the data on the characteristic. For writing process, the first thing to check is if the characteristic needs an enable notification request. If central does not explicitly enable the notifications on the peripheral, the peripheral will not send notifications back upon receiving the data. The notifications can be enabled by calling:

mBluetoothGatt.setCharacteristicNotification(characteristic, true);

The android application attached with the resource of this chapter does not perform writing to characteristic function but it can easily be extended by just implementing the following function in the application:

 private boolean writeToCharacteristic(BluetoothGattCharacteristic ...

Get Building Bluetooth Low Energy Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.