0.0.15 • Published 3 years ago
kindredsdk v0.0.15
kindredsdk
About this library:
This is a React Native Bluetooth Low Energy library wrapping react-native-ble-plx.
It supports:
- scanning for nearby BLE devices
- connecting to a BLE device
- connecting to device
- discovering services and characteristics
- validating the discovered service and characteristics
- registering notification and disconnect listeners
- disconnecting from a connected BLE device
- reading kindred device status
- writing kindred device timestamp
- reading record status and index
- reading record data
- writing record index
- acknowledging successful read and incrementing record index
- checking if a device is connected
- background mode in iOS
- background mode on Android
Configuration and installation:
iOS:
- Open project root folder
- npm install --save kindredsdk
- npm install --save react-native-ble-plx
- npm install —save react-native-background-actions
- Enter ios folder and run pod update
- From within the ios folder, enter the ‘YourAppName’ folder and open the ‘Info.plist’ file
- Add a new row with the key ’NSBluetoothAlwaysUsageDescription’ with the value ‘App uses BLE’
- To support background mode, open the application in Xcode and in the application target go to the ‘Signing & Capabilities’ tab, click ‘+ Capability’, click ‘Background modes’ and enable ‘Uses Bluetooth LE accessories’ and ‘Background processing’.
Android:
- Ensure completion of iOS steps 1, 2, 3 and 4.
- Open the application in Android Studio and open the ‘AndroidManifest.xml’ file.
- Add the following between the manifest tags:\ <uses-permission android:name="android.permission.INTERNET"/>\ <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>\ <uses-permission android:name="android.permission.WAKE_LOCK"/>\ <uses-permission android:name="android.permission.BLUETOOTH"/>
- Add the following between the application tags:\ <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask"/>