GithubHelp home page GithubHelp logo

hhy5277 / react-native-ble-plx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dotintent/react-native-ble-plx

0.0 1.0 0.0 4.89 MB

React Native BLE library

License: Apache License 2.0

JavaScript 11.48% Java 10.61% Groovy 0.85% Ruby 0.22% Shell 0.23% Objective-C 1.68% C 0.01% Swift 74.92%

react-native-ble-plx's Introduction

react-native-ble-plx

About this library

This is React Native Bluetooth Low Energy library using RxBluetoothKit and RxAndroidBle under the hood.

It supports:

What this library does NOT support:

Recent Changes

1.0.3

  • Integrated Travis CI to test library and check its integration with multiple RN versions.
  • Library's build.gradle prefers buildToolsVersion, compileSdkVersion & targetSdkVersion specified in rootProject.
  • Added Typescript definitions.
  • Removed outdated example project.
  • Updated dev dependencies and the README file.

All previous changes

Documentation & Support

Interested in React Native project involving Bluetooth Low Energy? We can help you!

Documentation can be found here.

Contact us at Gitter if you have any questions, feedback or want to help!

Configuration & Installation

iOS (pure react-native, example setup)

  1. npm install --save react-native-ble-plx
  2. react-native link react-native-ble-plx
  3. Add empty Swift file if you don't have at least one:
    • Select File/New/File...
    • Choose Swift file and click Next.
    • Name it however you want, select your targets and create it.
    • Accept to create Objective-C bridging header.
  4. Minimal supported version of iOS is 8.0
  5. 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.

iOS (expo/Podfile, example setup)

  1. Make sure your Expo project is ejected (formerly: detached). You can read how to do it here and here.
  2. npm install --save react-native-ble-plx
  3. react-native link react-native-ble-plx
  4. Add empty Swift file if you don't have at least one:
    • Select File/New/File...
    • Choose Swift file and click Next.
    • Name it however you want, select your application target and create it.
    • Accept to create Objective-C bridging header.
  5. Update your ios/Podfile to contain:
    pod 'react-native-ble-plx', :path => '../node_modules/react-native-ble-plx'
    pod 'react-native-ble-plx-swift', :path => '../node_modules/react-native-ble-plx'
    
  6. Enter ios folder and run pod update
  7. Minimal supported version of iOS is 8.0
  8. 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. react-native link react-native-ble-plx
  3. In build.gradle of app module make sure that min SDK version is at least 18:
android {
    ...
    defaultConfig {
        minSdkVersion 18
        ...
  1. 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"/>
    <uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_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"/>

    <uses-sdk
        android:minSdkVersion="18"
        ...

Troubleshooting

Problems with Proguard

Add this to your app/proguard-rules.pro

-dontwarn com.polidea.reactnativeble.**

react-native-ble-plx's People

Contributors

bitcrumb avatar cierpliwy avatar corymsmith avatar cretezy avatar dariuszseweryn avatar davidstritzl avatar guillane avatar iegik avatar jakublipinski avatar jerzykleszcz avatar jsphpl avatar konradrodzik avatar leo3linbeck avatar literator avatar lukefanning avatar lukerayman avatar mikolak avatar mmerickel avatar pandabearcoder avatar patlux avatar piotrdubiel avatar pouljohn1 avatar radko93 avatar shumih avatar stinodes avatar wouterh-dev avatar wung-s avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.