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
  • Initializing the MOVE SDK
  • Create SDK instance
  • Full code example
  1. MOVE SDK
  2. Getting Started
  3. Android

Quick Start

Get the MOVE SDK running

PreviousInstallationNextiOS

Last updated 3 years ago

Initializing the MOVE SDK

To be able to use the SDK, several permission need to be granted. This is described in .

Create SDK instance

Start by creating a SDK instance using the Move.Builder.

It is recommended that the required permissions are requested before initializing the SDK.

import io.dolphin.move.MoveSdk
...
var sdk: MoveSdk = MoveSdk.Builder()
    .transportModes(ModeOfTransport.DRIVING)
    .authentication(MoveAuth.Auth(productId,"contractId","accessToken","refreshToken"))
    .init(context)

You need to replace productId, contractId, accessToken, and refreshToken with your own values.

In order to successfully initialize and run the SDK, the user's must already be fetched (), and the required must be granted. If the provided is invalid, the SDK will not initialize and complete with .AuthInvalid. If the required permissions are missing, the SDK will initialize but go into missing permission error .

The initialization of the MoveSdk is asynchronous and you will be notified regarding state changes with the . The init can be called on the main thread or even on background threads. On successful initialization the changes to READY.

Now that there is an instance of the SDK, the detection may be started with , which should lead to an RUNNING state of the MoveSdk.

The MoveSdkis collecting data only when inRUNNING state.

Full code example

// Initialize sdk
 
moveAuth?.let {
   val moveSdk= MoveSdk.Builder()
    .timelineDetectionService(TimelineDetectionService.DRIVING, TimelineDetectionService.WALKING, TimelineDetectionService.BICYCLE)
    .drivingServices(DrivingService.DistractionFreeDriving, DrivingService.DrivingBehaviour)
    .recognitionNotification(recognitionNotification)
    .tripNotification(drivingNotification)
    .sdkStateListener(sdkStateListener)
    .authStateUpdateListener(authListener)
    .tripStateListener(tripStateListener)
    .authentication(moveAuth)
    .init(applicationContext);
...
 
... 
// in your MoveSdk.StateListener
  onStateChanged(sdk: MoveSdk, state: MoveSdkState) {
   val state = moveSdk.getSdkState()
   if (state is Ready) {
     moveSdk.startAutomaticDetection()
   }
  }
Permission Handling
MoveAuth
permissions
MoveAuth
MoveConfigurationError
State
MoveSdkState
startAutomaticDetection()
MoveStateListener
see also here