⚙️ iOS 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.
RPEntry.instance.virtualDeviceToken = "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, ELM connection, or app lifecycle transitions.
Usage
RPEntry.instance.setEnableSdk(true)
RPEntry.instance.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.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.disableTracking = true
Manual Tracking Control
Start manual tracking:
RPEntry.instance.disableTracking = false
RPEntry.instance.startPersistentTracking()
Stop manual tracking:
RPEntry.instance.stopTracking()
RPEntry.instance.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.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.disableTracking = true
Sign-on (start of shift)
RPEntry.instance.setEnableSdk(true)
RPEntry.instance.disableTracking = false
Sign-off (end of shift)
RPEntry.instance.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
Property | Description |
---|---|
virtualDeviceToken | Unique identifier for the device. Required before activating the SDK. |
setEnableSdk(true/false) | Fully enables or disables internal SDK services. |
disableTracking (true/false) | Controls whether the SDK can automatically start tracking. |
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.
- In manual (On Demand) workflows, on app launch always bring the SDK to a safe baseline (call
stopTracking()
and setdisableTracking = true
) to avoid stuck sessions after unexpected termination. - For shift-based scenarios, explicitly switch SDK and tracking policy at shift start and end.
Updated about 5 hours ago