Dolphin MOVE SDK
SDK
1.x
1.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
      • React Native
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Services
      • React Native
        • Initialization
        • Services
    • Models
      • MoveAuth
      • MoveConfig
      • MoveConfigurationError
      • MoveDeviceStatus
      • MoveSDKState
      • MoveTripState
      • MoveAuthState
      • Listeners/Callbacks
    • Appendix
      • Android
        • Token refresh
        • Permission Handling
        • Battery optimization
        • Notification Management
      • iOS
        • Permissions Handling
        • App Store
  • MOVE Backend
    • MOVE Timeline
    • MOVE State
    • MOVE Last Location
    • MOVE Generic Notifier
    • Open Api Specification
  • Changelog
    • Android
    • iOS
  • Data privacy (GDPR)
Powered by GitBook
On this page
  • Detection Services
  • Start Automatic Detection
  • Stop Automatic Detection
  • Force Trip Recognition
  • Finish Current Trip
  • Ignore Current Trip
  • Processing Services
  • Get SDK State
  • Set SDK State Listener
  • Get SDK Auth State
  • Set SDK Auth State Listener
  • Get Trip State
  • Set Trip State Listener
  • Get Device Status
  • Set Device Status Listener
  • Set Metadata Listener
  • Set Log Listener
  • Set Console Logging State
  • Delete Local Data
  • Shutdown SDK
  • Synchronize User Data
  • Configuration services
  • Update authentication
  1. MOVE SDK
  2. API Interface
  3. iOS

Services

iOS

PreviousInitializationNextReact Native

Last updated 2 years ago

Shared Instance

Use the shared instance as your interface to the MOVE SDK.

static let shared: MoveSDK

Detection Services

Start Automatic Detection

Starts the required detection services stated in the passed on initialization. Starting the service will set the to .running.

Precondition: SDK should be in.ready

func startAutomaticDetection()

Stop Automatic Detection

Stops the automatic detection service, including all SDK services like driving detection, points of interest, walking and places. Stopping the service will set the back to .ready.

Precondition: SDK should be in.running.

func stopAutomaticDetection()

Force Trip Recognition

Temporarily calibrates the SDK to the highest detection mode.

In order to optimize battery consumption, the SDK goes through different detection modes with different battery consumption levels, depending on the user's current behavior and activity. In general, the SDK is responsible for alternating between those different detection modes.

The SDK also provides hosting apps this API to call if they have their own reasons (like buttons, sensors or beacons) to believe that the user is starting a trip. This will make sure the SDK is on the highest detection state to detect the trip faster.

func forceTripRecognition()

Finish Current Trip

Ends the current ongoing trip.

func finishCurrentTrip()

If this API is called while the user is active on a driving trip, a new trip will start again right away. If the intention is to un-track the ongoing trip, call ignoreCurrentTripAPI.

Ignore Current Trip

Ignores the current ongoing trip.

func ignoreCurrentTrip()

Processing Services

Get SDK State

func getSDKState() -> MoveSDKState

Return

Latest SDK State

Set SDK State Listener

func setSDKStateListener(listener: SDKStateCallback)
func setSDKStateListener(_ listener: SDKStateCallback)

Callback

Get SDK Auth State

func getAuthState() -> MoveAuthState

Return

Latest SDK State

Set SDK Auth State Listener

func setAuthStateUpdateListener(listener: AuthStateCallback)
func setAuthStateUpdateListener(_ listener: AuthStateCallback)

Callback

Authentication Expiry

Get Trip State

func getTripState() -> MoveTripState

Return

Set Trip State Listener

func setTripStateListener(listener: TripStateCallback)
func setTripStateListener(_ listener: TripStateCallback)

Callback

Get Device Status

func getDeviceStatus() -> MoveDeviceStatus

Return

Set Device Status Listener

func setDeviceStatusListener(listener: DeviceStatusCallback)
func setDeviceStatusListener(_ listener: DeviceStatusCallback)

Callback

Set Metadata Listener

Provide a block returning bundle of key-value pairs to be appended to the trip metadata before the trip finishes.

Host apps can use this API to add any app-level information (for ex. Böuetooth beacon detected, foreground/background time, etc) to append to a trip as metadata. This metadata will be forwarded back along with the trip when fetched by the client-server, so the host app can utilize it in its app. Note: The SDK will not use this metadata element in any way, it is just passed through to the product.

The block provides the trip's start and stop times. Make sure to only include metadata events that are relevant for the given start and end periods.

func setTripMetaDataListener(listener: MetaDataCallback)
func setTripMetaDataListener(_ listener: MetaDataCallback)

Callback

Block that gets invoked on every trip finish. The block provides the trip's start and stop times.

Usage Example

MoveSDK.shared.setMetadataListener{ (tripStartTime, tripEndTime)
  getCollectedMetadataForPeriod(start: tripStartTime, end: tripEndTime)
}

Set Log Listener

Provide a block to be invoked every time a new SDK log event occurs.

func setLogListener(listener: LogCallback)
func setLogListener(_ listener: LogCallback)

Callback

Block that gets invoked with every new log event.

Set Console Logging State

Toggles console logging enabled state.

This doesn't affect recieving the logs via setLogListener(_ listener: MoveLogCallback) API.

Enabled by default.

func setConsoleLogging(enabled: Bool) 

Parameter

enabled

Boolean that sets SDK console logging to enabled or not.

Delete Local Data

func deleteLocalData()

Shutdown SDK

Shutdown SDK shared instance.

Precondition: SDK should be initialized.

func shutDown()

Synchronize User Data

Used to force synchronizing user data with the SDK server. Limited to once per 2 minutes.

func synchronizeUserData()

Returns FALSE in case there are Timeline-relevant packages in the queue that remain to be sent to the SDK Backend; and it returns TRUE in case the queue is empty.

Configuration services

Update authentication

func update(auth: MoveAuth, completion: ((MoveConfigurationError?) -> Void)? = nil)

Parameter

auth

The user's updated Auth object with the new token.

Callback

completion

Precondition: SDK should be in.running .

This API will end the ongoing trip and set back to .idle. The SDK is responsible for detecting the trip start and end points. The SDK also provides hosting apps this API to call if they have their own reasons (like sensors or beacons) to believe that the user's trip has ended.

Precondition: should be in an active trip.

More information about trip states can be found in .

This API will set the ongoing to .ignored. Data of ignored trips is purged and not sent to the server.

Precondition: should be in an active trip.

Gets the current.

Provide a block to be invoked every time changes.

Set the listener before initializing the SDK to anticipate the SDK changes triggered by the initialization API. Here the host app can start the SDK services when is.readyor handle errors if occurred.

Block that gets invoked every time is changed and provides the updated .

Gets the current .

Provide a block to be invoked every time changes.

Block that gets invoked every time is updated.

The host app is expected to monitor updates viaauthStateUpdateListener(Android / ) API and handle those changes accordingly.

Check for more details about authentication expiry and renewal.

Gets the current .

Current

Provide a block to be invoked every time changes.

Block that gets invoked every time is changed and provides the updated .

Gets the current .

Current

Provide a block to be invoked every time changes.

Block that gets invoked every time is changed and provides the updated .

Deletes all the collected user SDK data stored on the device. This doesn't affect the .

Precondition: should be initialized.

Stops SDK services, send the queued user data, and de-initializes the SDK. After that is executed, the will transit to .uninitialized.

Updates SDK . On SDK auth expiry, the Builder.authStateListner will trigger expired state. The host app is expected to fetch a new using its product API key and pass it to the MoveSDK using the following API:

Block that gets invoked on auth update completion with an optional for potential updating errors.

MoveConfig
MoveSDKState
MoveSDKState
MoveSDKState
MoveSDKState
MoveSDKState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
MoveSDKState
MoveSDKState
MoveSDKState
State
MoveSDKState
MoveAuthState
MoveAuthState
MoveTripState
MoveTripState
MoveDeviceStatus
MoveDeviceStatus
MoveSDKState
MoveSDKState
MoveSDKState
MoveAuth
MoveAuth
MoveAuthState
iOS
MoveSDKState
MoveSDKState
MoveSDKState
MoveAuthState
MoveAuthState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
MoveDeviceStatus
MoveDeviceStatus
MoveDeviceStatus
MoveDeviceStatus
MoveConfigurationError
Authentication updates and expiry
SDKStateCallback
AuthStateCallback
TripStateCallback
DeviceStatusCallback
MetaDataCallback
LogCallback