Ionic / Capacitor

Learn how to install the Sahha SDK in your Ionic / Capacitor project

Installation

Follow these steps to install the Sahha SDK in your Ionic / Capacitor 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-capacitor

Step 2) Sync Projects

Sync the changes to your native iOS / Android projects.

Terminal

$ ionic capacitor sync

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.

Xcode Project Settings


React Native

Follow these additional steps to install the Sahha SDK in your 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-capacitor";


What's next?