Skip to main content

React Native SDK Installation

Get started with the DoorstepAI React Native SDK to add intelligent delivery tracking to your cross-platform application.

Prerequisites

Before you begin, ensure you have:

  • React Native 0.60+ with autolinking support
  • Valid API Key from DoorstepAI
  • iOS 14+ and Android API level 21+ deployment targets
  • Node.js 14+ and npm/yarn
Development Environment

We recommend using the latest stable version of React Native for the best development experience and access to the latest platform features.

Installation

Install the Package

Add the DoorstepAI React Native SDK to your project:

npm install @doorstepai/dropoff-sdk
# or
yarn add @doorstepai/dropoff-sdk

iOS Setup

For iOS, install the native dependencies:

cd ios && pod install && cd ..

Android Setup

For Android (React Native 0.60+), the SDK will be automatically linked via autolinking—no additional manual steps are required.

Platform-Specific Configuration

iOS Configuration

Update your ios/YourApp/Info.plist file with the required permissions:

ios/YourApp/Info.plist
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app requires access to your location for enhanced delivery intelligence</string>

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app requires access to your location for enhanced delivery intelligence</string>

<key>NSMotionUsageDescription</key>
<string>This app requires access to motion data for enhanced delivery intelligence</string>

<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
</dict>

Android Configuration

Update your android/app/src/main/AndroidManifest.xml file with the required permissions:

android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourapp.package">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

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

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

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

<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.sensor.gyroscope" />
<uses-feature android:name="android.hardware.sensor.barometer" />
<uses-feature android:name="android.hardware.sensor.compass" />
<uses-feature android:name="android.hardware.sensor.proximity" />

<application>
<!-- Your app components -->
</application>
</manifest>

Permission Requirements

PermissionPurposePlatformRuntime Required
ACCESS_FINE_LOCATIONPrecise location trackingAndroidYes
ACCESS_COARSE_LOCATIONApproximate locationAndroidYes
ACCESS_BACKGROUND_LOCATIONBackground location accessAndroidYes
ACTIVITY_RECOGNITIONMotion and activity detectionAndroidYes
FOREGROUND_SERVICEBackground processingAndroidNo
FOREGROUND_SERVICE_LOCATIONLocation foreground serviceAndroidNo
FOREGROUND_SERVICE_DATA_SYNCData sync foreground serviceAndroidNo
POST_NOTIFICATIONSDelivery notificationsAndroidYes (API 33+)
WAKE_LOCKKeep device awake during trackingAndroidNo
ACCESS_WIFI_STATEWiFi state accessAndroidNo
ACCESS_NETWORK_STATENetwork state accessAndroidNo
INTERNETNetwork communicationAndroidNo
NSLocationWhenInUseUsageDescriptionLocation access during app usageiOSYes
NSLocationAlwaysAndWhenInUseUsageDescriptionBackground location accessiOSYes
NSMotionUsageDescriptionMotion and sensor dataiOSYes
NOTIFICATION PERMISSION (ANDROID 13+)

Starting with Android 13 (API level 33), apps must request the POST_NOTIFICATIONS permission at runtime.

Verification

To verify the installation was successful:

  1. Build your project:

    # iOS
    npx react-native run-ios

    # Android
    npx react-native run-android
  2. Check for import errors in files using the SDK

  3. Verify permissions are properly configured in platform-specific files

Import Test

Try importing the SDK in your React Native app:

App.js
import { DoorstepAI, RootDoorstepAI } from '@doorstepai/dropoff-sdk';

// Test basic import
console.log('DoorstepAI SDK imported successfully');

Troubleshooting Installation

Common Issues

Build Errors

  • Error: "Could not resolve dependency"
    • Solution: Check internet connection and verify the package name
    • Solution: Ensure you're using the correct version number

iOS Pod Install Issues

  • Error: "Pod install failed"
    • Solution: Run cd ios && pod install --repo-update && cd ..
    • Solution: Clean build folder: cd ios && xcodebuild clean && cd ..

Android Build Issues

  • Error: "Native module not found"
    • Solution: Ensure autolinking is enabled (React Native 0.60+)
    • Solution: Clean and rebuild: cd android && ./gradlew clean && cd ..

Next Steps

Now that you have the SDK installed and configured:

  1. 📚 Learn SDK Usage - Initialize and use the SDK
  2. 💡 View Examples - See complete implementation examples
Ready to Implement?

Head over to our Usage Guide to learn how to implement the SDK and start using delivery tracking in your React Native app.