Skip to content

Getting started — Android SDK

This page covers the minimum steps to get the RoadSave SDK running in your Android project. For the full reference, see the integration guide.


Prerequisites

Requirement Minimum
Android API level 24 (Android 7.0 Nougat)
targetSdk 35
AGP 8.x
Google Play Services 21.1.0+ (GMS devices)
HMS Core 6.x+ (Huawei devices)

1. Add the AAR

Download roadsave-sdk-<version>.aar from the GitHub Releases page, place it in app/libs/, and declare the dependency. See Downloads for checksum verification and the full runtime dependency list.

repositories {
    google()
    mavenCentral()
    maven { url 'https://developer.huawei.com/repo/' }
}

dependencies {
    implementation files('libs/roadsave-sdk-<version>.aar')
    implementation 'com.google.android.gms:play-services-location:21.1.0'
    implementation 'com.huawei.hms:location:6.4.0.300'
    implementation 'com.huawei.hms:maps:5.3.0.300'
    implementation 'com.huawei.agconnect:agconnect-core:1.9.5.300'
}

2. Add manifest permissions

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_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.INTERNET" />

3. Detect platform and initialize

// Application.onCreate()
if (RoadSave.isHmsAvailable(this)) {
    GlobalEnvSetting.useHms()
} else {
    GlobalEnvSetting.useGms()
}

4. Configure and start monitoring

val sdk = RoadSave(context)
sdk.setRoadSaveListener(myListener)

val config = RoadSaveConfiguration(context, "YOUR_APP_ID", "USER_ID", true, true)
sdk.configurationSetup(config)

Next steps