---
updatedAt: 2026-07-27T13:58:23.000Z
agentTools:
  projectIndex: https://docs.damoov.com/llms.txt
---

# Methods for Android app

Methods for Android app — Damoov developer documentation.

## SDK initialization

Initialize the SDK once in the main application process, preferably in the `Application` class.

```kotlin
class App : Application() {
    override fun onCreate() {
        super.onCreate()
        TrackingApi.getInstance().initialize(this)
    }
}
```

You can check whether initialization has completed:

```kotlin
val isInitialized = TrackingApi.getInstance().isInitialized()
```

## Log in

Set the device ID received from your backend, then enable the SDK. The device ID must be a valid GUID. It is stored by the SDK and does not need to be set again after every application launch.

```kotlin
val trackingApi = TrackingApi.getInstance()
val deviceId = getDeviceIdFromYourBackend() // Must be a valid GUID
trackingApi.setDeviceID(deviceId)

if (trackingApi.areAllRequiredPermissionsAndSensorsGranted()) {
    trackingApi.setEnableSdk(true)
}
```

## Log out

Logout disables the SDK, clears the device ID, Properties, and Sub-units.

```kotlin
trackingApi.logout()
```

## Enable/Disable SDK

***

**Enable SDK**

```kotlin
val trackingApi = TrackingApi.getInstance()
if (trackingApi.areAllRequiredPermissionsAndSensorsGranted()) {
    trackingApi.setEnableSdk(true)
}
```

**Disable SDK**

Starting from `3.0.0`, disabling the SDK triggers the following actions:

* stops tracking
* stops heartbeats
* forces unsent data upload
* disables the SDK

```kotlin
trackingApi.setEnableSdk(false)
```

Disabling the SDK does not clear the device ID. Use `logout()` when the user signs out.

## Check SDK status

```kotlin
val isSdkEnabled = trackingApi.isSdkEnabled()
```

After `setEnableSdk(false)`, the SDK may finish uploading pending data before it is fully disabled:

```kotlin
val isDisablePending = trackingApi.isSdkDisablePending()
```

## Check required permissions status

Check both Android permissions and required device settings such as Location and battery optimization:

```kotlin
val isReady = trackingApi.areAllRequiredPermissionsAndSensorsGranted()
```

To check Android runtime permissions only:

```kotlin
val permissionsGranted = trackingApi.areAllRequiredPermissionsGranted()
```

## Enable/ Disable Tracking

***

These methods are not applicable to Android. Use [Enable/Disable SDK](https://docs.telematicssdk.com/docs/methods-for-android-app#enabledisable-sdk).

## Manual start/ stop tracking

***

### Tracking mode overview

`TrackingMode.Persistent`

In this mode, all tracks started in both manual and automatic modes will be recorded as persistent. Track recording continues until `trackingApi.stopTracking()` is called or the maximum persistent tracking interval is reached.

In this mode, you can manually start a persistent track using either:

```kotlin
trackingApi.startTracking()
trackingApi.startTrackAsPersistent()
```

`TrackingMode.Standard`

In this mode, all tracks started in both manual and automatic modes will be recorded as standard. Track recording continues until `trackingApi.stopTracking()` is called or the motion stop detector is triggered.

### Set tracking mode

```kotlin
trackingApi.setTrackingMode(TrackingMode.Persistent)
trackingApi.setTrackingMode(TrackingMode.Standard)
```

### Get tracking mode

```kotlin
val mode = trackingApi.getTrackingMode()
```

### Configure persistent tracking interval

The allowed interval is from `5` to `600` minutes. The default interval is `240` minutes (`4` hours).

```kotlin
trackingApi.setMaxPersistentTrackingInterval(240)
val maxInterval = trackingApi.getMaxPersistentTrackingInterval()
```

### Manual start

```kotlin
trackingApi.startTracking()
```

`trackingApi.startTracking()` starts tracking using the currently configured `TrackingMode`.

### Manual stop

```kotlin
trackingApi.stopTracking()
```

### Start a persistent track once

```kotlin
trackingApi.startTrackAsPersistent()
```

`trackingApi.startTrackAsPersistent()` starts recording a persistent track once in manual mode, regardless of the configured `TrackingMode`.

`trackingApi.startPersistentTracking()` is deprecated in `4.0.0`. Use `trackingApi.startTrackAsPersistent()` instead.

### Check current track state

```kotlin
val isTracking = trackingApi.isTracking()
```

### Get tracking state

```kotlin
val trackingState = trackingApi.getTrackingState()
```

Response:

```kotlin
data class TrackingState(
    val automaticTrackingStatus: TrackingStatus,
    val manualTrackingStatus: TrackingStatus
)
```

```kotlin
enum class TrackingStatus {
    ENABLED,
    DEVICE_ID_NOT_SET,
    SDK_DISABLED,
    DISABLED_BY_SETTINGS,
    DISABLED_BY_SERVER,
    DISABLED_BY_SCHEDULE
}
```

## Trip metadata

Use trip metadata to associate recorded trips with business entities such as an order, driver, vehicle, or shift.

### Properties

Properties are a persistent flat key-value map attached to trips. Calling `setProperties()` replaces the whole map.

When Properties change during an active trip, the SDK completes the current trip and starts a new one with the updated Properties. Passing the same map does not restart tracking. Properties remain active for subsequent trips until replaced or cleared.

**Set Properties**

```kotlin
trackingApi.setProperties(
    mapOf(
        "order_id" to "12345",
        "shift" to "morning"
    )
)
```

**Get Properties**

```kotlin
val properties = trackingApi.getProperties()
```

**Clear Properties**

```kotlin
trackingApi.clearProperties()
```

Properties must contain from 1 to 20 entries. Keys and values must be non-blank and no longer than 255 characters. Use `clearProperties()` to remove all Properties.

### Sub-units

Sub-units are a persistent flat key-value map for analytical trip classification, for example a driver, vehicle, or session.

Updating or clearing Sub-units does not restart an active trip. Changes made during tracking apply to the next trip. Sub-units remain active until replaced or cleared.

**Set Sub-units**

```kotlin
trackingApi.setSubUnits(
    mapOf(
        "DriverId" to "D-001",
        "VehicleId" to "V-042"
    )
)
```

**Get Sub-units**

```kotlin
val subUnits = trackingApi.getSubUnits()
```

**Clear Sub-units**

```kotlin
trackingApi.clearSubUnits()
```

Sub-units must contain from 1 to 5 entries. Keys and values must be non-blank and no longer than 255 characters. Use `clearSubUnits()` to remove all Sub-units.

Properties and Sub-units are cleared automatically on `logout()` or when the device ID is cleared or changed.

## Activity Log

Use Activity Log to attach business events to the current active trip without stopping or splitting it, for example a delivery, checkpoint, or depot arrival.

```kotlin
trackingApi.addActivityLog(
    text = "Delivered order #101",
    data = mapOf("order_id" to "101")
)
```

The `data` parameter is optional:

```kotlin
trackingApi.addActivityLog(text = "Arrived at depot")
```

Activity Log entries can be added only while tracking is active. Each trip supports up to 100 entries. The `text` parameter must be non-blank and no longer than 1,000 characters. The optional `data` map supports up to 20 entries; its keys and values must be non-blank and no longer than 255 characters.

The SDK attaches the last known location when available. The call may take up to one second, so call it from a background thread when blocking the calling thread would affect the UI.

When Properties change during tracking, existing Activity Log entries remain attached to the completed trip. The new trip starts with an empty Activity Log.

## Device ID registration state

```kotlin
val deviceIdRegistrationState = trackingApi.getDeviceIdRegistrationState()
```

Response:

```kotlin
data class DeviceIdRegistrationState(
    val status: DeviceIdRegistrationStatus,
    val checkedAtMillis: Long?
)
```

`checkedAtMillis` contains the Unix timestamp in milliseconds of the latest registration check. It is `null` until the status has been checked.

```kotlin
enum class DeviceIdRegistrationStatus {
    NOT_SET,
    UNKNOWN,
    REGISTERED,
    NOT_REGISTERED
}
```

## SDK version

```kotlin
val sdkVersion = trackingApi.getSdkVersion()
```

Returns the full SDK version in `major.minor.patch.build` format, for example `4.1.0.15`.

## Enable or disable Accident Detection

Accident Detection is disabled by default. Enable the SDK before changing this setting.

```kotlin
trackingApi.setAccidentDetectionEnabled(true)
trackingApi.setAccidentDetectionEnabled(false)
```

Check the current state:

```kotlin
val enabled = trackingApi.isAccidentDetectionEnabled()
```

## Accident Detection Sensitivity

### Set sensitivity

```kotlin
trackingApi.setAccidentDetectionMode(AccidentDetectionSensitivity.Normal)
```

Sets the sensitivity level for accident detection.

Available values:

* `AccidentDetectionSensitivity.Sensitive`
* `AccidentDetectionSensitivity.Normal`
* `AccidentDetectionSensitivity.Tough`

### Reset accident detection settings

```kotlin
trackingApi.resetAccidentDetectionSettings()
```

Get the current settings:

```kotlin
val settings = trackingApi.getAccidentDetectionSettings()
```

## Passive detection

### Check passive detection state

```kotlin
val enabled = trackingApi.isPassiveDetectionEnabled()
```

### Enable or disable passive detection

```kotlin
trackingApi.setPassiveDetectionEnabled(true)
trackingApi.setPassiveDetectionEnabled(false)
```

## Future Tags (deprecated)

The Future Tag APIs are deprecated in `4.1.0`:

* `addFutureTrackTag()`
* `getFutureTrackTags()`
* `removeFutureTrackTag()`
* `removeAllFutureTrackTags()`

Use [Properties](#properties) for persistent trip metadata instead.

## Get tracks

***

```kotlin
/**
 * Returns tracks information. Tracks are cached in local DB.
 *
 * @param locale Language in which tracks are to arrive.
 * @param startDate Start date format "yyyy-MM-dd'T'HH:mm:ss ZZ" or null.
 * @param endDate End date format "yyyy-MM-dd'T'HH:mm:ss ZZ" or null.
 * @param offset Offset number for pagination.
 * @param limit Maximum number of items for pagination.
 */
```

```kotlin
// IMPORTANT! Do not call this method on the Main thread.
fun getTracks(
    locale: Locale,
    startDate: String? = null,
    endDate: String? = null,
    offset: Int,
    limit: Int
): Array<Track>
```

**Response**

```kotlin
data class Track(
    var addressStart: String?,
    var addressEnd: String?,
    var endDate: String?,
    var startDate: String?,
    var trackId: String?,
    var accelerationCount: Int,
    var decelerationCount: Int,
    var distance: Double,
    var duration: Double,
    var rating: Double,
    var phoneUsage: Double,
    var originalCode: String?,
    var hasOriginChanged: Boolean,
    var midOverSpeedMileage: Double,
    var highOverSpeedMileage: Double,
    var drivingTips: String?,
    var shareType: String?,
    var cityStart: String?,
    var cityFinish: String?,
    var ratingCornering: Double,
    var ratingAcceleration: Double,
    var ratingBraking: Double,
    var ratingSpeeding: Double,
    var ratingPhoneDistraction: Double,
    var ratingTimeOfDay: Double,
    var rating100: Double,
    var ratingCornering100: Double,
    var ratingAcceleration100: Double,
    var ratingBraking100: Double,
    var ratingSpeeding100: Double,
    var ratingPhoneDistraction100: Double,
    var ratingTimeOfDay100: Double,
    val addressStartParts: AddressParts?,
    val addressFinishParts: AddressParts?,
    val tags: Array<TrackTag>?
)
```

```kotlin
data class AddressParts(
    var countryCode: String?,
    var country: String?,
    var county: String?,
    var postalCode: String?,
    var state: String?,
    var city: String?,
    var distinct: String?,
    var street: String?,
    var house: String?
)
```

```kotlin
data class TrackTag(
    var name: String? = null,
    var sourceType: String? = null,
    var source: String? = null
)
```

## Get trip details

```kotlin
/**
 * Returns detailed track information. Track details are cached in local DB.
 *
 * @param locale Language in which track data should be returned.
 * @param trackId Track ID.
 */
```

```kotlin
// IMPORTANT! Do not call this method on the Main thread.
fun getTrackDetails(trackId: String, locale: Locale): TrackDetails
```

**Response**

```kotlin
data class TrackDetails(
    val addressStart: String?,
    val addressEnd: String?,
    val endDate: String?,
    val startDate: String?,
    val trackId: String?,
    val accelerationCount: Int,
    val decelerationCount: Int,
    val distance: Double,
    val duration: Double,
    val rating: Double,
    val phoneUsage: Double,
    val originalCode: String?,
    val hasOriginChanged: Boolean,
    val midOverSpeedMileage: Double,
    val highOverSpeedMileage: Double,
    val points: Array<TrackPoint>?,
    val drivingTips: String?,
    val shareType: String?,
    val cityStart: String?,
    val cityFinish: String?,
    val ratingCornering: Double,
    val ratingAcceleration: Double,
    val ratingBraking: Double,
    val ratingSpeeding: Double,
    val ratingPhoneDistraction: Double,
    val ratingTimeOfDay: Double,
    val rating100: Double,
    val ratingCornering100: Double,
    val ratingAcceleration100: Double,
    val ratingBraking100: Double,
    val ratingSpeeding100: Double,
    val ratingPhoneDistraction100: Double,
    val ratingTimeOfDay100: Double,
    val addressStartParts: AddressParts?,
    val addressFinishParts: AddressParts?,
    val tags: Array<TrackTag>?
)
```

## Change transportation type

```kotlin
/**
 * Allows you to change the track type to a type from the dictionary.
 *
 * @param trackToken Track ID
 * @param newCode New track type code from the track origin dictionary.
 */
fun changeTrackOrigin(trackToken: String, newCode: String): Boolean
```

**Dictionary**

* `OriginalDriver`
* `Passenger`
* `Bus`
* `Motorcycle`
* `Train`
* `Taxi`
* `Bicycle`
* `Other`

## Upload unsent trips

The SDK uploads trips automatically. Use this method to request an immediate upload of locally stored unsent trips:

```kotlin
trackingApi.uploadUnsentTrips()
```

## Get unsent trips

```kotlin
val unsentTrips = trackingApi.getUnsentTrips()
```

Get only the number of unsent trips:

```kotlin
val unsentTripCount = trackingApi.getUnsentTripCount()
```

## Send a custom heartbeat

```kotlin
trackingApi.sendCustomHeartbeats(reason = "CustomHeartbeat")
```

<br />