react-native-ble-plx is a comprehensive React Native library providing a low-level API for interacting with Bluetooth Low Energy (BLE) devices on both iOS and Android platforms. The current stable version is 3.5.1, with recent releases indicating an active development and maintenance cadence addressing bugs and improvements. It supports core BLE functionalities such as observing the Bluetooth adapter state, scanning for devices, connecting to peripherals, discovering services and characteristics, reading/writing characteristic values, observing notifications/indications, reading RSSI, and negotiating MTU. A key differentiator is its inclusion of an Expo config plugin for easier integration into managed Expo workflows (requiring prebuilding). The library explicitly does not support Bluetooth Classic, inter-phone BLE communication (peripheral mode), device bonding, or beacon technologies. It is built to provide robust control over BLE interactions in React Native applications.
npm install react-native-ble-plxVerified import paths — ran on the pinned version, not inferred.
Initializes the BleManager, requests necessary Bluetooth permissions for Android, monitors Bluetooth adapter state, and performs a device scan, logging found devices. It also demonstrates how to handle state changes and stop scanning.
Ensure all calls to `destroyClient`, `cancelTransaction`, `setLogLevel`, `startDeviceScan`, and `stopDeviceScan` are `await`ed or have `.then().catch()` handlers.
Thoroughly test your application when upgrading from v2.x to v3.0.0+. Pay attention to Bluetooth operations, especially on iOS 16, and review any direct interaction with native modules if custom bridges are in use.
Ensure your application design accounts for a single `BleManager` instance. If you were creating multiple instances for different purposes, you might need to refactor to use a single manager and manage its state and operations carefully.
For Expo projects, add `react-native-ble-plx` to the `plugins` array in `app.json` or `app.config.js` and run `npx expo prebuild` before building or running your app on a device or simulator.
Implement robust runtime permission requests for Android and ensure `Info.plist` is correctly configured for iOS. Lack of permissions will lead to scanning or connection failures without clear error messages from the library.
Upgrade to `react-native-ble-plx@3.5.1` or newer. Implement robust error handling and null checks around device, service, and characteristic access after discovery. Ensure `BleManager.destroy()` is called when no longer needed.
Upgrade to `react-native-ble-plx@3.5.1` or newer to resolve this Android-specific crash.
For Expo projects, ensure you are using a custom development client or a prebuilt standalone app. Add the config plugin to `app.json` and run `npx expo prebuild`.
Verify that all necessary Android permissions (`ACCESS_FINE_LOCATION`, `BLUETOOTH_SCAN`, `BLUETOOTH_CONNECT` as per API level) are requested and granted at runtime. For iOS, confirm `NSBluetoothAlwaysUsageDescription` and `NSBluetoothPeripheralUsageDescription` are present and correctly filled in `Info.plist`.
Upgrade to `react-native-ble-plx@3.2.1` or newer to benefit from fixes related to `this` context and Fast Refresh on Android.