> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spikeapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native SDK Setup

> This document provides a setup guide of the Spike SDK for React Native platform.

## Version

**Current React Native SDK Version:** `4.7.13`

## Resources

* React Native Package: [Available here](https://www.npmjs.com/package/react-native-spike-sdk)
* API Reference for Spike SDK: [Available here](https://spike_api.gitlab.io/spike-react-native-sdk)
* Example app: [Available here](https://gitlab.com/spike_api/public/spike-sdk-examples/-/tree/master/react-native-v3)

## Requirements

* **iOS Version**: `13.0+`.
* **Xcode 26** is required.
* **Android Version**: `9.0+` (Level 28, P, Pie)

## SDK Installation

Install the react-native-spike-sdk package from [npm](https://www.npmjs.com/package/react-native-spike-sdk):

```text theme={null}
yarn add react-native-spike-sdk
```

## iOS Setup Guide

Use `pod install` and `pod update` commands from `ios/` folder of your app to install/update `SpikeSDK`.

### iOS Signing & Capabilities

To add HealthKit support to your application's Capabilities.

* Open the `iOS/` folder of your project in Xcode
* Select the project name in the left sidebar
* Open the Signing & Capabilities section
* In the main view select '+ Capability' and double-click HealthKit

More details you can find [here](https://developer.apple.com/documentation/healthkit/setting_up_healthkit).

### Info.plist

Add HealthKit permissions descriptions to your `Info.plist` file:

```xml theme={null}
<key>NSHealthShareUsageDescription</key>
<string>We will use your health information to better track workouts.</string>

<key>NSHealthUpdateUsageDescription</key>
<string>We will update your health information to better track workouts.</string>
```

## Android Setup Guide

To add the SDK to your project, you have to add the following to your project's `build.gradle` file in the repositories block.

```gradle theme={null}
allprojects {
    repositories {
        // Other repositories
        maven {
            url 'https://gitlab.com/api/v4/projects/43396247/packages/maven'
        }
    }
}
```

### Android Permissions

Include the necessary health permissions in your AndroidManifest.xml to fully leverage the Spike SDK and access data from apps integrated with Health Connect. Please refer to [this guide](https://developer.android.com/health-and-fitness/guides/health-connect/get-started#declare-permissions) for details on the required permissions.

**Note**: Only request permissions essential to your app’s functionality. Requesting unused permissions may lead to app store rejections.

```xml theme={null}
    <uses-permission android:name="android.permission.health.READ_NUTRITION"/>
    <uses-permission android:name="android.permission.health.READ_ACTIVE_CALORIES_BURNED"/>
    <uses-permission android:name="android.permission.health.READ_TOTAL_CALORIES_BURNED"/>
    <uses-permission android:name="android.permission.health.READ_STEPS"/>
    <uses-permission android:name="android.permission.health.READ_DISTANCE"/>
    <uses-permission android:name="android.permission.health.READ_ELEVATION_GAINED"/>
    <uses-permission android:name="android.permission.health.READ_RESTING_HEART_RATE"/>
    <uses-permission android:name="android.permission.health.READ_HEART_RATE_VARIABILITY"/>
    <uses-permission android:name="android.permission.health.READ_FLOORS_CLIMBED"/>
    <uses-permission android:name="android.permission.health.READ_BASAL_METABOLIC_RATE"/>
    <uses-permission android:name="android.permission.health.READ_SLEEP"/>
    <uses-permission android:name="android.permission.health.READ_HEART_RATE"/>
    <uses-permission android:name="android.permission.health.READ_EXERCISE"/>
    <uses-permission android:name="android.permission.health.READ_SPEED"/>
    <uses-permission android:name="android.permission.health.READ_POWER"/>
    <uses-permission android:name="android.permission.health.READ_OXYGEN_SATURATION"/>
    <uses-permission android:name="android.permission.health.READ_BLOOD_GLUCOSE"/>
    <uses-permission android:name="android.permission.health.READ_RESPIRATORY_RATE"/>
    <uses-permission android:name="android.permission.health.READ_WEIGHT"/>
    <uses-permission android:name="android.permission.health.READ_HEIGHT"/>
    <uses-permission android:name="android.permission.health.READ_BODY_FAT"/>
    <uses-permission android:name="android.permission.health.READ_LEAN_BODY_MASS"/>
    <uses-permission android:name="android.permission.health.READ_BODY_WATER_MASS"/>
    <uses-permission android:name="android.permission.health.READ_BODY_TEMPERATURE"/>
    <uses-permission android:name="android.permission.health.READ_BLOOD_PRESSURE"/>
    <uses-permission android:name="android.permission.health.READ_BONE_MASS"/>

```

Add an intent filter to your activity definition so that you can request the permissions at runtime.

```xml theme={null}
<intent-filter>
    <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent-filter>
```

To handle Android 14, you also need to add activity-alias to your AndroidManifest.xml It is just a wrapper for the activity that requests permissions, so no real activity is necessary.

```xml theme={null}
<activity-alias
    android:name="ViewPermissionUsageActivity"
    android:exported="true"
    android:targetActivity=".MainActivity"
    android:permission="android.permission.START_VIEW_PERMISSION_USAGE">
    <intent-filter>
        <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
        <category android:name="android.intent.category.HEALTH_PERMISSIONS" />
    </intent-filter>
</activity-alias>
```
