⚙️ iOS Implementation

Initialization

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

try RPEntry.instance.setDeviceID(deviceId: "DEVICE_ID")

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, ELM connection, or app lifecycle transitions.

Usage

RPEntry.instance.setEnableSdk(true)
RPEntry.instance.setDisableTracking(disableTracking: false)

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

RPEntry.instance.setDisableTracking(disableTracking: true)
RPEntry.instance.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.

Usage

RPEntry.instance.setEnableSdk(true)
RPEntry.instance.setDisableTracking(disableTracking: true)

Manual Tracking Control

Start manual tracking:

RPEntry.instance.setDisableTracking(disableTracking: false)
RPEntry.instance.startTrackAsPersistent()

Stop manual tracking:

RPEntry.instance.stopTracking()
RPEntry.instance.setDisableTracking(disableTracking: true)

Important (App Relaunch Safety):
If the app is terminated during an active manual tracking session, ensure the SDK resets to a safe state on app launch to avoid a stuck session. Add the following to:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    RPEntry.instance.stopTracking()
    RPEntry.instance.setDisableTracking(disableTracking: true)
    return true
}

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)

RPEntry.instance.setEnableSdk(false)
RPEntry.instance.setDisableTracking(disableTracking: true)

Sign-on (start of shift)

RPEntry.instance.setEnableSdk(true)
RPEntry.instance.setDisableTracking(disableTracking: false)

Sign-off (end of shift)

RPEntry.instance.setDisableTracking(disableTracking: false)
RPEntry.instance.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
setDeviceId(deviceId:)Unique identifier for the device. Required before activating the SDK.
setEnableSdk(true/false)Fully enables or disables internal SDK services.
setDisableTracking(disableTracking: false/true)Controls whether the SDK can automatically start tracking.
startTrackAsPersistent() / 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.
  • In manual (On Demand) workflows, on app launch always bring the SDK to a safe baseline (call stopTracking() and set setDisableTracking(disableTracking: true) to avoid stuck sessions after unexpected termination.
  • For shift-based scenarios, explicitly switch SDK and tracking policy at shift start and end.