Home > OS >  BLE Android to iOS Conversion
BLE Android to iOS Conversion

Time:08-20

I am converting a project for BLE communication in android to iOS. Can someone please assist me whats going on in this piece of code. Thank you!

UUID uuid = UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG);
BluetoothGattDescriptor descriptor = gattCharacteristic.getDescriptor(uuid);                            
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
gatt.writeDescriptor(descriptor);


public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";

CodePudding user response:

This Descriptor write tells the GATT server running on the remote device that you are interested in receiving notifications for this characteristic. You don't have to explicitly write this descriptor in iOS like you have to do on Android. Instead call the setNotifyValue method to enable notifications, which will send value under the hood in the same way.

  • Related