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 15+ and Android API level 24+ 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>NSBluetoothAlwaysUsageDescription</key>
<string>This app requires access to Bluetooth for enhanced delivery intelligence</string>

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

Android Configuration​

The Android SDK library contributes its tracking components and permission declarations through manifest merge. Add INTERNET, which the library does not declare, to android/app/src/main/AndroidManifest.xml:

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" />
<application>
<!-- Your app components -->
</application>
</manifest>

The merged SDK manifest supplies the runtime rows in the table below plus foreground-service, wake-lock, network/Wi-Fi-state, boot, and legacy Bluetooth compatibility declarations. Inspect the Merged Manifest view for the exact result. Do not add neverForLocation to BLUETOOTH_SCAN or NEARBY_WIFI_DEVICES: the SDK uses nearby radio observations for positioning. The SDK does not require specific sensor hardware at install time.

Permission Requirements​

PermissionPurposePlatformRuntime Required
ACCESS_FINE_LOCATIONCore GPS trackingAndroidYes
ACCESS_COARSE_LOCATIONFallback when fine location is unavailableAndroidYes
ACCESS_BACKGROUND_LOCATIONTracking while the app is backgroundedAndroidYes
ACTIVITY_RECOGNITIONDrive/walk detectionAndroidYes
BLUETOOTH_SCANNearby BLE scanning on Android 12+AndroidYes
NEARBY_WIFI_DEVICESNearby Wi-Fi access on Android 13+AndroidYes
FOREGROUND_SERVICERequired host permission for foreground servicesAndroidNo
FOREGROUND_SERVICE_LOCATIONDeclares the location foreground service typeAndroidNo
POST_NOTIFICATIONSShows the tracking status notificationAndroidYes
WAKE_LOCKPrevents the device from sleeping mid-deliveryAndroidNo
ACCESS_WIFI_STATEImproves location accuracy via WiFi signalsAndroidNo
ACCESS_NETWORK_STATEDetects connectivity for data syncAndroidNo
INTERNETSends tracking data to DoorstepAIAndroidNo
NSLocationWhenInUseUsageDescriptionForeground GPS trackingiOSYes
NSLocationAlwaysAndWhenInUseUsageDescriptionTracking while the app is backgroundediOSYes
NSMotionUsageDescriptionDrive/walk detection via motion sensorsiOSYes
NSBluetoothAlwaysUsageDescriptionNearby BLE scanningiOSYes
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

  4. Test the import 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. 🔐 Review Permissions - Implement staged, cross-platform prompts
  3. 💡 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.