⚙️ Android Implementation

Initialization

Before using any SDK operation mode, you must set a virtual device token.
This token uniquely identifies the device within the system and is required to send data to the server.

TrackingApi.getInstance().setDeviceToken("TOKEN")

Operating Modes

1. Automatic Mode

Description
This is the primary operating mode where the SDK automatically starts and stops tracking based on internal events — such as location changes or app lifecycle transitions.

Usage

with(TrackingApi.getInstance()) {
    if (!isSdkEnabled()) {
        if (!isDeviceIdValid()) {
            setDeviceToken("TOKEN")
        }
        setEnableSdk(true)
    }
}

Behavior

  • The SDK determines when to start and stop tracking automatically.
  • No manual user actions are required.
  • Recommended for most use cases: corporate fleet tracking, logistics, or background monitoring apps.

Notes

  • The SDK runs in the background and manages event-based data collection.
  • All logic is handled internally without user interaction.

2. Disabled Mode

Description
Completely disables the SDK and stops all tracking activity.
Use this mode when data collection must be paused.

Usage

with(TrackingApi.getInstance()) {
    stopTracking()
    setEnableSdk(false)
}

Behavior

  • The SDK stops entirely and does not respond to system or app events.
  • All automatic triggers are disabled until the SDK is re-enabled.

Notes

  • Use this for temporary or permanent shutdowns.
  • Tracking will remain inactive until explicitly reactivated.

3. On Demand Mode (Manual Mode)

Description
The SDK does not automatically initiate tracking.
Tracking sessions can be started and stopped manually by the user or app logic.

Default (SDK Off)

with(TrackingApi.getInstance()) {
    if (isSdkEnabled()) {
        stopTracking()
        setEnableSdk(false)
    } else {
        if (!isDeviceIdValid()) {
            setDeviceToken("TOKEN")
        }
    }
}

Manual Tracking Control

Start manual tracking:

with(TrackingApi.getInstance()) {
    setEnableSdk(true)
    startPersistentTracking()
}

Stop manual tracking:

with(TrackingApi.getInstance()) {
    stopTracking()
    setEnableSdk(false)
}

4. Shift Mode

Description
A mode designed for shift-based operations — tracking is only allowed during active working hours (“shifts”).
Ideal for transportation, delivery, or taxi applications.

Default (SDK Off)

with(TrackingApi.getInstance()) {
    if (isSdkEnabled()) {
        stopTracking()
        setEnableSdk(false)
    } else {
        if (!isDeviceIdValid()) {
            setDeviceToken("TOKEN")
        }
    }
}

Sign-on (start of shift)

with(TrackingApi.getInstance()) {
    setEnableSdk(true)
}

Sign-off (end of shift)

with(TrackingApi.getInstance()) {
    stopTracking()
    setEnableSdk(false)
}

Behavior

  • Outside of shifts, the SDK is off and does not collect data.
  • At shift start, you can enable the SDK while keeping tracking disabled until the operator is ready.
  • At shift end, disable tracking again and/or fully turn off the SDK.

Notes

  • Provides complete control over when data is collected.
  • Prevents unintended tracking outside working hours.

Summary of Control Properties

PropertyDescription
virtualDeviceTokenUnique identifier for the device. Required before activating the SDK.
setEnableSdk(true/false)Fully enables or disables internal SDK services.
startPersistentTracking() / stopTracking()Used in manual modes to explicitly start or stop a tracking session.

Integration Recommendations

  • Always set the virtual device token before enabling the SDK.
  • For shift-based scenarios, explicitly switch SDK and tracking policy at shift start and end.