React Native Bluetooth Low Energy library
npm install @onekeyfe/react-native-ble-plx
alt="react-native-ble-plx library logo"
src="docs/logo.png"
height="300"
style="margin-top: 20px; margin-bottom: 20px;"
/>
This is React Native Bluetooth Low Energy library wrapping Multiplatform Ble Adapter.
It supports:
- observing device's Bluetooth adapter state
- scanning BLE devices
- making connections to peripherals
- discovering services/characteristics
- reading/writing characteristics
- observing characteristic notifications/indications
- reading RSSI
- negotiating MTU
- background mode on iOS)
- turning the device's Bluetooth adapter on
It does NOT support:
- bluetooth classic devices.
- communicating between phones using BLE (Peripheral support)
- bonding peripherals
This version (2.x) breaks compatibility with old RN versions. Please check old README (1.x)
for the old instructions or migration guide.
| React Native | 2.0.0 |
| ------------- | ------------------------------ |
| 0.63.3 | :white_check_mark: |
| 0.62.2 | :white_check_mark: |
| 0.61.5 | :white_check_mark: |
| 0.60.6 | :white_check_mark: |
2.0.3
- Updated MultiplatformBleAdapter to version 0.1.9
Interested in React Native project involving Bluetooth Low Energy? We can help you!
Documentation can be found here.
Quick introduction can be found here
Contact us at intent.
Contact us at Gitter if you have any questions, feedback or want to help!
1. Make sure your Expo project is ejected (formerly: detached). You can read how to do it here and here. (only for expo)
1. Follow steps for iOS/Android.
1. npm install --save react-native-ble-plx
1. Enter ios folder and run pod update
1. Add NSBluetoothAlwaysUsageDescription in info.plist file. (it is a requirement since iOS 13)
1. If you want to support background mode:
- In your application target go to Capabilities tab and enable Uses Bluetooth LE Accessories in
Background Modes section.
- Pass restoreStateIdentifier and restoreStateFunction to BleManager constructor.
1. npm install --save react-native-ble-plx
1. In top level build.gradle make sure that min SDK version is at least 18:
``groovy`
buildscript {
ext {
...
minSdkVersion = 21
...
build.gradle
1. In make sure to add jitpack repository to known repositories:
`groovy`
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
AndroidManifest.xml
1. (Optional) In , add Bluetooth permissions and update :
`xml
...
`
Add this to your app/proguard-rules.pro
```
-dontwarn com.polidea.reactnativeble.**