Hi @mc ,
Thanks for reaching out.
When sending bytes over BLE in .NET MAUI, the key is that both iOS and Android handle writes asynchronously, so calling WriteValue or SetValue doesn’t mean the bytes are fully sent yet. You need to use the platform callbacks that signal completion.
iOS:
Use CBCharacteristicWriteType.withResponse when writing. Then implement the delegate peripheral(_:didWriteValueFor:error:) to know when the write is done: https://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate/peripheral(_:didwritevaluefor:error:)-4f5ea
Android:
Set the value with characteristic.setValue(...), then call gatt.writeCharacteristic(characteristic). Handle completion in BluetoothGattCallback.onCharacteristicWrite(...), which is called when the write finishes: https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback#onCharacteristicWrite(android.bluetooth.BluetoothGatt,%20android.bluetooth.BluetoothGattCharacteristic,%20int)
Basically, withResponse / default write type = callback that tells you it’s done. Without a response, there’s no confirmation.
A couple of extra tips:
- BLE often limits how many bytes you can send in a single write, so large byte arrays may need to be split into chunks.
- Writes
withoutResponsewill never trigger a callback, so completion confirmation is only possible withwithResponse(iOS) or the default write type (Android).
Disclaimer: The links above are not from Microsoft but it's official links from Apple and Google.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.