🐛 BLE writeCharacteristicWithResponseForService not working on Android while functioning on iOS
Prerequisites
- [x] I checked the documentation and FAQ without finding a solution
- [x] I checked to make sure that this issue has not already been filed
Expected Behavior
- The receipt printing function should work consistently across both iOS and Android platforms
- The BLE write characteristic operation should complete successfully
- A success message should be displayed upon successful printing
Current Behavior
iOS: Works as expected, successfully prints receipts
Android:
- No response from the write characteristic method
- No error messages are thrown
- The success/error callbacks are not triggered
Library version
3.4.0
Device
Android 13
Environment info
expo-env-info 1.2.2 environment info:
System:
OS: macOS 15.2
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
Watchman: 2024.09.16.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.2, iOS 18.2, macOS 15.2, tvOS 18.2, visionOS 2.2, watchOS 11.2
Android SDK:
API Levels: 30, 34, 35
Build Tools: 30.0.3, 34.0.0, 35.0.0
IDEs:
Xcode: 16.2/16C5032a - /usr/bin/xcodebuild
npmPackages:
expo: ^52.0.27 => 52.0.27
expo-router: ~3.5.24 => 3.5.24
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
react-native: 0.76.6 => 0.76.6
react-native-web: ~0.19.10 => 0.19.13
npmGlobalPackages:
eas-cli: 12.6.2
Expo Workflow: bare
Steps to reproduce
- Connect to BLE device
- Attempt to print receipt using the provided code
- Observe that iOS successfully prints while Android fails silently
Formatted code sample or link to a repository
const printReceipt = async () => {
if (!device || !serviceUUID || !characteristicUUID) {
toast.error('Belum terhubung dengan perangkat');
return;
}
try {
const printCommand = await getPrintCommand();
const bufferPrint = Buffer.from(printCommand).toString('base64');
console.log(serviceUUID, characteristicUUID, device);
await device.writeCharacteristicWithoutResponseForService(
serviceUUID,
characteristicUUID,
bufferPrint
);
toast.success('Print berhasil');
} catch (error) {
toast.error(`Print gagal: ${error}`);
}
};
Relevant log output
when console log output (console.log(serviceUUID, characteristicUUID, device));
LOG 00001800-0000-1000-8000-00805f9b34fb 00002a00-0000-1000-8000-00805f9b34fb {"id": "02:15:12:29:8C:D7", "isConnectable": null, "localName": null, "manufacturerData": null, "mtu": 23, "name": "RPP02", "overflowServiceUUIDs": null, "rssi": null, "serviceData": null, "serviceUUIDs": null, "solicitedServiceUUIDs": null, "txPowerLevel": null}
Additional information
When attempting to print receipts using BLE communication, the writeCharacteristicWithResponseForService method works as expected on iOS devices but fails silently on Android devices. The method call does not trigger any response or error on Android, preventing the receipt printing functionality.
getting same issue when writing command on characterstic
Hello @Mochamad-Rizky. Thank you for bringing this up! We've added the issue to our backlog and will work on a fix soon.
"react-native-ble-plx": "3.2.1", - it is working with this version