Initialization and configuration

Introduction

Documentation is provided using Kotlin language.

Initialization

The library is initialized defining organization (client_id) and user unique identification (user_id)
Optionally configuration, user country, and vehicle can be set.

val initListener = object: Driving.InitListener {
    override fun onInitFinished(result: Int) {
        if (result ==  Driving.InitListener.SUCCESS)  {...}
    }
}

val initializer = Driving.Initializer.Builder
  (applicationContext, client_id, user_id, initListener) 
  .userCountry("FRA"))
  .configuration(configuration)
  .vehicleSettings(vehicle)
  .build()
Driving.initialize(initializer)

Configuration

Several options can be provided mainly affecting online interactions with compute server.

val configuration = Configuration.Builder()
  .sendOnMobileData(false)
  .sendInRoaming(false)
  .disableGeofences(false)
  .dontUploadTrips(false)
  .build()
Driving.getInstance().configuration = configuration

Vehicle settings

Vehicle can optionally be defined. This will affect scoring applied.

val vehicle= VehicleSettings.Builder()
  .vehicleType(VehicleType.Car)
  .weight(1570)
  .length(4560)
  .fuelType(FuelType.Diesel)
  .trailers(0)
  .axles(2)
  .maxSpeed(90)
  .hazmat(false)
  .build()
Driving.getInstance().vehicleSettings = vehicle