• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

dotintent/react-native-ble-plx: React Native BLE library

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

dotintent/react-native-ble-plx

开源软件地址(OpenSource Url):

https://github.com/dotintent/react-native-ble-plx

开源编程语言(OpenSource Language):

JavaScript 63.1%

开源软件介绍(OpenSource Introduction):

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

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

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

  1. Make sure your Expo project is ejected (formerly: detached). You can read how to do it here and here. (only for expo)
  2. Follow steps for iOS/Android.

iOS (example setup)

  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"/>
        <uses-permission-sdk-23 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

Problems with Proguard

Add this to your app/proguard-rules.pro

-dontwarn com.polidea.reactnativeble.**



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap