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
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):
dependencies {
implementation 'ai.doorstep.com:doorstepai-dropoff-sdk:2.0.0'
// Other dependencies...
}
Sync Project
After adding the dependency, sync your project:
- Click "Sync Now" in the notification bar, or
- 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:
<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:
<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
| Permission | Purpose | Required | Runtime |
|---|---|---|---|
INTERNET | Network communication | Yes | No |
ACCESS_FINE_LOCATION | Precise location tracking | Yes | Yes |
ACCESS_COARSE_LOCATION | Approximate location | Yes | Yes |
ACCESS_BACKGROUND_LOCATION | Background location access | Yes | Yes |
ACTIVITY_RECOGNITION | Motion and activity detection | Yes | Yes |
FOREGROUND_SERVICE | Background processing | Yes | No |
FOREGROUND_SERVICE_LOCATION | Location foreground service | Yes | No |
FOREGROUND_SERVICE_DATA_SYNC | Data sync foreground service | Yes | No |
POST_NOTIFICATIONS | Delivery notifications | Yes | Yes (API 33+) |
WAKE_LOCK | Keep device awake during tracking | Yes | No |
ACCESS_WIFI_STATE | WiFi state access | Yes | No |
ACCESS_NETWORK_STATE | Network state access | Yes | No |
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:
- Build your project (
Build → Rebuild Project) - Check for import errors in files using DoorstepAI SDK classes
- 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:
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:
- Check our troubleshooting guide
- Review the Android integration examples
- Contact our support team at support@doorstep.ai
Next Steps
Now that you have the SDK installed and configured:
- 📚 Learn SDK Usage - Initialize and use the SDK
- 💡 View Examples - See complete implementation examples
Head over to our Usage Guide to learn how to implement the SDK and start using delivery tracking in your Android app.