Dolphin MOVE SDK
2.x
2.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
        • Access Control
        • Configuration
        • Timeline
        • Points of Interest
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
        • Troubleshooting
      • React Native
      • Flutter
      • Move SDK CLI
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Setup
        • Services
      • React Native
        • Components
        • Initialization
        • Services
      • Flutter
        • Initialization
        • Services
    • Models
      • Listeners/Callbacks
      • MoveAssistanceCallStatus
      • MoveAuth
      • MoveAuthError
      • MoveAuthResult
      • MoveAuthState
      • MoveConfig
      • MoveConfigurationError
      • MoveDevice
      • MoveDeviceStatus
      • MoveGeocodeError
      • MoveHealthItem
      • MoveHealthScore
      • MoveOptions
        • DeviceDiscovery
      • MoveSdkState
      • MoveSdkAndroidConfig
      • MoveTripState
      • MoveScanResult
      • MoveServiceFailure
      • MoveServiceWarning
      • MoveShutdownResult
    • Appendix
      • Token refresh
      • Android
        • Permission Handling
          • Permission Overview
          • Runtime Permissions
        • Battery optimization
        • Notification Management
      • iOS
        • Permissions Handling
        • App Store
      • React Native
        • Permission Handling
  • MOVE Backend
    • MOVE Backend
      • MOVE Admin API
      • MOVE TIMELINE API
      • MOVE State API
      • MOVE Last Location API
    • MOVE Generic Notifier
    • MOVE Assistance Notifier
    • Example requests
  • FAQ
  • Changelog
    • Android
    • iOS
    • React
    • Flutter
    • Backend
  • Data privacy (GDPR)
Powered by GitBook
On this page
  • Definition
  • Timing
  • Background-Fetch (recommended)
  1. MOVE SDK
  2. API Interface
  3. iOS

Initialization

API Interface / iOS

PreviousiOSNextSetup

Last updated 1 year ago

Definition

Initialize the SDK shared instance and prepare the required services based on the passed . SDK must be successfully initialized once before any of the SDK Services can be used. Call this API on the shared instance to initialize the SDK:

func initialize(launchOptions: [UIApplication.LaunchOptionsKey: Any]?)

Parameters

launchOptions

TheAPI must be executed beforereturns. We recommend calling it in .

Timing

Why should the initialization be called beforereturns?

Once the MOVE SDK has been successfully initialized and started for the first time, the SDK will then set up its timers, tasks, and system triggers to be able to automatically wake up in the background and start its services, even if the app has been killed by the user.

When the app wakes up in the background because of the SDK triggers and tasks, the SDK must be already initialized and started before receiving those events in order to be to handle them.

Initializing the MOVE SDK beforereturns will guarantee that all the required SDK components are initialized and ready to handle the triggered system events.

An exception is when it is the first time the SDK is initialized, as the host app might need to delay this step till the user is onboarded and system permission has been granted.

Background-Fetch (recommended)

How can you make sure that the app synchronises with the MOVE backend even if you have patches of offline operation ?

For security reasons we cannot schedule background data upload tasks to upload data to the MOVE backend. Hence, the application must be running (at least) in the background. In order to guarantee that data is sent in a timely manner, we recommend setting up a BackgroundFetch-functionality in the app delegate of your host application.

Additionally: the background fetch is essential in case you only configure WALKING in your MOVE project. In this case, the background fetch is the only mechanism to wake up your app in the background and record WALKING data in the first place.

iOS 12 and below

For background fetches to work in iOS12 and below you need to implement the background fetch callback of the app delegate:

func application(_: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
   MoveSDK.shared.performBackgroundFetch(completionHandler)
}

and set the minimum background fetch interval for example in the app delegate's didFinishLaunchingWithOptions() with an interval of e.g. 4 hours:

application.setMinimumBackgroundFetchInterval(backgroundRefreshInterval)

iOS 13 and up

[: Any]?

The launch options passed in.

Follow the guide at the The upload will start automatically as soon as the SDK switches into RUNNING state (SDK 1.6) respectively after initializing the SDK (SDK 2.x and higher).

MoveConfig
initialization
willFinishLaunchingWithOptions
didFinishLaunchingWithOptions
willFinishLaunchingWithOptions
willFinishLaunchingWithOptions
Apple developer documentation.
LaunchOptionsKey
willFinishLaunchWithOptions