1. Create a Github Personal Access Token (classic) with read:packages
access selected.
2. Create an .npmrc
file in the root of your project with the following lines replacing GITHUB_ACCESS_TOKEN
with the token you've created.
3. Add the Passio SDK dependency to your package.json
and run npm install
or yarn
.
or
4. Ensure the native dependencies are linked to your app.
For iOS, run pod install.
If pod install is failed with error message Specs satisfying the ReactNativePassioSDK (from ../node_modules/@passiolife/nutritionai-react-native-sdk-v2) dependency were found, but they required a higher minimum deployment target.
, ensure Podfile is configured with minimum ios version '13.0'
For Android, add this implementation line to the dependencies section on app/build.gradle
file.
Also for Android, make sure the android project is configured with minSdkVersion 26 or above (check the project's build.gradle
file).
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com
This project provides React Native bindings for the Passio SDK.
Please note that the SDK will currently not run in the iOS simulator. We hope to change this in the future, but an iOS test device is required for now.
React Native v0.60.0 or higher
Xcode 13.4 or higher
iOS 13 or higher
Android API level 26 or higher
Cocoapods 1.10.1 or higher
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com
Once the SDK is ready, you can start food detection.
Android Platform: You need the user's permission to access the camera.
IOS Platform: Enter a value for NSCameraUsageDescription
in your Info.plist so the camera may be utilized.
To show the live camera preview, add the DetectionCameraView
to your view
Try to run the above code in component and Point the phone to the image below and see if you are getting the correct food in console log Got food detection event
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com
When starting food detection with PassioSDK.startFoodDetection
you will receive a FoodDetectionEvent
. This is the structure of that data class:
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com
For the SDK to work, it requires a proper license key.
The license key can be requested at support@passiolife.com
When your component mounts, configure the SDK using your Passio provided developer key and start food detection.
autoUpdate: true
: Set to true
to enable the download of AI models from Passio's servers.
The possible states of the SDK after calling configure. Switch on sdkStatus.mode
to access the data associated with each state.
MODE: notReady
, isReadyForDetection
and error
notReady
: SDK is not ready due to missing model files. Please download the specified file and call configure
again, passing in the localFileURLs of the downloaded files.
isReadyForDetection
: SDK configured successfully. This status much be reached before calling startFoodDetection
error
: SDK failed to configure in an unrecoverable way. Please read the error message for more information
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com