You are expecting a boolean back from writeCharacteristic as success, but the function returns a status code where BluetoothStatusCodes.SUCCESS means it worked, but also has a value of 0. So would incorrectly show it failed based on your code.