Skip to content

akhockey21/react-native-ble-plx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-ble-plx library logo

About this library

This is React Native Bluetooth Low Energy library wrapping Multiplatform Ble Adapter.

It supports:

It does NOT support:

  • bluetooth classic devices.
  • communicating between phones using BLE (Peripheral support)
  • bonding peripherals

Table of Contents

  1. Compatibility
  2. Recent Changes
  3. Documentation & Support
  4. Configuration & Installation
  5. Troubleshooting

Compatibility

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
0.62.2
0.61.5
0.60.6

Recent Changes

2.0.3

  • Updated MultiplatformBleAdapter to version 0.1.9

Current version changes All previous changes

Documentation & Support

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!

Configuration & Installation

Expo SDK 43+

  1. A custom expo-dev-client can now be built along with config plugins to avoid the need to eject from Expo. Learn how to integrate react-native-ble-plx with Expo here. (only for expo SDK 43+)

Legacy Expo (SDK < 43)

  1. Make sure your Expo project is ejected (formerly: detached). You can read how to do it here. (only for Expo SDK < 43)
  2. Follow steps for iOS/Android.
  1. npm install --save react-native-ble-plx
  2. Enter ios folder and run pod update
  3. Add NSBluetoothAlwaysUsageDescription in info.plist file. (it is a requirement since iOS 13)
  4. 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.

Android (example setup)

  1. npm install --save react-native-ble-plx

  2. In top level build.gradle make sure that min SDK version is at least 18:

    buildscript {
        ext {
            ...
            minSdkVersion = 21
            ...
  3. In build.gradle make sure to add jitpack repository to known repositories:

    allprojects {
        repositories {
          ...
          maven { url 'https://www.jitpack.io' }
        }
    }
  4. (Optional) In AndroidManifest.xml, add Bluetooth permissions and update <uses-sdk/>:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        ...
        <uses-permission android:name="android.permission.BLUETOOTH"/>
        <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
        
        <!-- Please use FINE location instead of COARSE:
          https://github.com/dotintent/react-native-ble-plx/issues/730#issuecomment-681946908 -->
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    
        <!-- Add this line if your application always requires BLE. More info can be found on:
            https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#permissions
          -->
        <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
    
        ...

Troubleshooting

About

React Native BLE library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 61.4%
  • Java 11.6%
  • TypeScript 11.0%
  • JavaScript 10.9%
  • Objective-C 3.9%
  • Ruby 0.4%
  • Other 0.8%