Skip to content

ReactNative SDK 3.8.2

Sample Code

The quickest and simplest way to kickstart your journey with the ReactNative SDK is by downloading and experimenting with our full-featured sample code:

IMPORTANT

In the above sample codes, the strings __YOUR_USER_ID__ and __YOUR_API_KEY__ should be replaced by your own User ID and API Key repectively. Please contact us to obtain your User ID and API Key.

SDK Installation

In your ReactNative project, install the SDK with the npm install or yarn add commands:

bash
npm install "https://sdk.panoptic.ai/npm/react-native-vital-sign-plugin-3.8.2.tgz"
bash
yarn add "https://sdk.panoptic.ai/npm/react-native-vital-sign-plugin-3.8.2.tgz"

TIP

If you are using Yarn v2 or later, you might need to include the package name in the command, such as yarn add vital-sign-camera@"https://sdk.panoptic.ai/npm/react-native-vital-sign-plugin-3.8.2.tgz".

Project Integration (for iOS)

IMPORTANT

This version of the SDK requires targeting iOS 12 or above. If targeting iOS 11, please use SDK version 3.7.x.

Fix deployment target of the dependencies

The dependency ZIPFoundation needs to have deployment target of iOS 11. Please update the Podfile to force the deployment target to 11:

ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'ZIPFoundation'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
      end      
      # Force CocoaPods targets to always build for x86_64
      config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'x86_64'
    end
  end
end

Use static framework linking

Add the following to Podfile use static framework linking:

ruby
use_frameworks! :linkage => :static

Also, disable Flipper by removing or commenting out the fipper_configuration line:

ruby
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => FlipperConfiguration.enabled,

Camera Permission

When developing for iOS, you need to allow the app to use the camera by specifying the following in the file Info.plist:

xml
<key>NSCameraUsageDescription</key>
<string>Use for measuring vital signs</string>

TIP

In Info.plist, the string "Use for measuring vital signs" is an example description of the camera usage. You should specify your own description that matches the usage of your application.

Project Integration (for Android)

IMPORTANT

Please note that for Android, the minimum SDK version must be at least 24.

Update the android/app/build.gradle file:

groovy
android {
    // ...

    // Add the packaging options
    packagingOptions {
        pickFirst '**/*.so'
    }
}

dependencies {

    // Add the following dependencies.
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
    implementation files('../../node_modules/react-native-vital-sign-plugin/android/libs/vital-sign-engine-debug.aar')

    // ...
}

// Add this line
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

In android/gradle.properties, add:

groovy
kotlinVersion=1.8.0

Camera Permission

When developing for Android, you need to allow the app to use the camera by specifying the following in the file AndroidManifest.xml:

xml
<uses-permission android:name="android.permission.CAMERA" />

What's New

3.8.2 (28-Aug-2024)

  • Fixed the sample app build problem for iOS. Specifically the following error:

    console
    [!] Invalid `Podfile` file:
    [!] Invalid `RNScreens.podspec` file: undefined method `install_modules_dependencies' for Pod:Module
    Did you mean?  install_flipper_dependencies.

3.8.1 (20-Jul-2024)

  • Fixed sample code TypeScript problems.
  • Updated PromisKit to version 8.

3.8.0 (18-Jul-2024)

  • Sample code are updated to use ReactNative 0.70, which also fixed the Xcode 15 compatibility problems.
  • Updated iOS minimum deployment target to iOS 12.
  • Added sample code for age projection.
  • The default value of enableAgeProjection is changed to false.