React Native
Learn how to install the Sahha SDK in your React Native project
Installation
Follow these steps to install the Sahha SDK in your React Native project.
Step 1) Install the Sahha NPM Package
Install the sahha-react-native
NPM Package inside the root folder of your React Native project.
Terminal
$ npm i sahha-react-native
Android
Follow these additional steps to install the Sahha SDK in your Android project.
Step 1) Add Permissions
Add the required permissions to your project's AndroidManifest.xml.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
iOS
Follow these additional steps to install the Sahha SDK in your iOS project.
Install CocoaPods
You will need to install CocoaPoads before you can install the Sahha SDK to your iOS project.
Visit cocoapods.org to learn how to install CocoaPods.
Step 1) Install Sahha Pod
Run pod install
from the Terminal
app in your project root folder.
$ pod install
Step 2) Project Settings
Setup Xcode
You will need to edit your Xcode project settings to enable the Sahha SDK.
React Native Project
Step 1) Import Sahha Module
Import the Sahha
module into any files inside your React Native project that use the SDK.
import Sahha from "sahha-react-native";
Expo Project
This section is for developers using Expo to run their React Native project.
The Sahha SDK can be used inside an Expo project
In order to use native platform code for Android and iOS, you will need to convert your Expo Go project to an Expo development build.
Visit the Expo documentation to learn how to create development builds.
Follow our guide to use the Sahha SDK in an Expo project
Browse the Sahha Expo demo app
We've also provided a demo app to show how to setup the Sahha SDK inside an Expo development build.
Updated about 1 month ago