Skip to main content

Android SDK Installation

Get started with the DoorstepAI Android SDK to add intelligent delivery tracking to your Android application.

Prerequisites

Before you begin, ensure you have:

  • Android Studio (latest stable version recommended)
  • Minimum SDK version: Android API level 24 (Android 7.0)
  • Target SDK version: Android API level 33+ (Android 13+)
  • Valid API Key from DoorstepAI
  • Kotlin or Java development environment
Development Environment

We recommend using Android Studio with the latest Android Gradle Plugin for the best development experience and access to the latest Android features.

Installation

Add SDK Dependency

Add the DoorstepAI Android SDK to your module-level build.gradle file (usually app/build.gradle):

app/build.gradle
dependencies {
implementation 'ai.doorstep.com:doorstepai-dropoff-sdk:2.0.0'

// Other dependencies...
}

Sync Project

After adding the dependency, sync your project:

  1. Click "Sync Now" in the notification bar, or
  2. Go to File → Sync Project with Gradle Files

Android Manifest Configuration

Required Permissions

Add the following permissions to your AndroidManifest.xml file outside the <application> tag:

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" />

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

Hardware Features

Add the following hardware feature declarations to your AndroidManifest.xml:

AndroidManifest.xml
<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" />

Permission Details

PermissionPurposeRequiredRuntime
INTERNETNetwork communicationYesNo
ACCESS_FINE_LOCATIONPrecise location trackingYesYes
ACCESS_COARSE_LOCATIONApproximate locationYesYes
ACCESS_BACKGROUND_LOCATIONBackground location accessYesYes
ACTIVITY_RECOGNITIONMotion and activity detectionYesYes
FOREGROUND_SERVICEBackground processingYesNo
FOREGROUND_SERVICE_LOCATIONLocation foreground serviceYesNo
FOREGROUND_SERVICE_DATA_SYNCData sync foreground serviceYesNo
POST_NOTIFICATIONSDelivery notificationsYesYes (API 33+)
WAKE_LOCKKeep device awake during trackingYesNo
ACCESS_WIFI_STATEWiFi state accessYesNo
ACCESS_NETWORK_STATENetwork state accessYesNo
Notification Permission (Android 13+)

Starting with Android 13 (API level 33), apps must request the POST_NOTIFICATIONS permission at runtime. Users must explicitly grant notification permission for the SDK to show delivery tracking notifications.

Permission Utilities

Certain permissions above need runtime approval. See the full DoorstepAIPermissionUtils helper class in Using the SDK → Runtime Permissions, then copy it into your app to check and request the required permissions:

if (DoorstepAIPermissionUtils.hasAllPermissions(context)) {
initializeSDK()
} else {
val missingPermissions = DoorstepAIPermissionUtils.getMissingPermissions(context)
// Launch permission request with the missing permissions
}

Verification

To verify the installation was successful:

  1. Build your project (Build → Rebuild Project)
  2. Check for import errors in files using DoorstepAI SDK classes
  3. Verify permissions are properly declared in your AndroidManifest.xml

Import Test

Try importing the SDK and calling init to sanity-check the build. See Using the SDK → Initialize SDK for the full initialization flow:

MainActivity.kt
import com.doorstepai.sdks.tracking.DoorstepAI

DoorstepAI.init(this) { result ->
result.fold(
onSuccess = { DoorstepAI.setAPIKey("your_api_key_here") },
onFailure = { error -> /* handle error */ }
)
}

Troubleshooting Installation

Common Issues

Build Errors

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

Manifest Merge Conflicts & Permission Issues

See the detailed troubleshooting guide in Examples for manifest merger errors and runtime permission handling.

Getting Help

If you encounter issues during installation:

  1. Check our troubleshooting guide
  2. Review the Android integration examples
  3. Contact our support team at support@doorstep.ai

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 Android app.