Appearance
SDK Integration
Once you receive the Binah_ReactNative_SDK_5.2.1.tgz
file, you are ready to add the React Native SDK to your application.
Follow the steps below to integrate the SDK into your application.
1. Add the Binah AI package to your Project
1.1. Copy the Binah_ReactNative_SDK_5.2.1.tgz
file into the root folder of your project.
1.2. Add: binah-react-native-sdk
: ./Binah_ReactNative_SDK_5.2.1.tgz
to the package.json
file, under dependencies
section:
"dependencies": {
"binah-react-native-sdk": "./Binah_ReactNative_SDK_5.2.1.tgz"
},
2. Android Integration with the SDK
2.1. In android/app/build.gradle
modify minSdkVersion to 27.
2.2. In android/settings.grade
add the following line:
include ':binah-react-native-sdk:binah-sdk'
2.3. In android/app/src/main/AndroidManifest.xml
add the following:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="true"/>
<uses-feature android:name="android.hardware.camera.front" android:required="true"/>
Additional setup when using Polar devices:
2.4. In your app's repositories section, add JitPack:
repositories {
...
maven { url 'https://jitpack.io' }
}
2.5. In your app's gradle dependencies section, add Polar dependencies:
dependencies {
...
implementation 'com.github.polarofficial:polar-ble-sdk:5.1.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
}
2.6. In your AndroidManifest.xml file, add the following permissions:
xml
<!-- The SDK needs Bluetooth scan permission to search for BLE devices.
Binah SDK doesn't use the scan to decide the location so "neverForLocation" permission
flag can be used.-->
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<!-- Binah SDK needs Bluetooth connect permission to connect for found BLE devices.-->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- Allows Binah SDK to connect to paired bluetooth devices. Legacy Bluetooth permission,
which is needed on devices with API 30 (Android Q) or older. -->
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<!-- Allows Binah SDK to discover and pair bluetooth devices. Legacy Bluetooth permission,
which is needed on devices with API 30 (Android Q) or older. -->
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<!-- Binah SDK needs the fine location permission to get results for Bluetooth scan. Request
fine location permission on devices with API 30 (Android Q). Note, if your application
needs location for other purposes than bluetooth then remove android:maxSdkVersion="30"-->
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="30" />
<!-- The coarse location permission is needed, if fine location permission is requested. Request
coarse location permission on devices with API 30 (Android Q). Note, if your application
needs location for other purposes than bluetooth then remove android:maxSdkVersion="30" -->
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="30" />
Build Android App Bundle (.aab)
When building the app as Android App Bundle (.aab extension), add the useLegacyPackaging
flag to build.gradle
file in the android
folder, under the android
section as the following example:
android {
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}
3. iOS Integration with the SDK
3.1. Add the following line to the project Podfile
:
pod 'binah-react-native-sdk', :path => '../node_modules/binah-react-native-sdk'
3.2. Grant the application camera permission in info.plist
:
<key>NSCameraUsageDescription</key>
<string>Used for vital signs monitoring</string>
Additional setup when using Polar devices:
3.3. Grant the application bluetooth permission in info.plist
xml
<key>NSBluetoothAlwaysUsageDescription</key>
<string>App needs access to your bluetooth in order to measure your health.</string>
3.4. Grant the application background mode permission in info.plist
xml
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
</array>