- Developers
- Sygic Mobile Telematics SDK
- iOS Library
- Initialization and configuration
Initialization and configuration
Introduction
Documentation is provided through Swift. You can find demo sample app here
Initialization
The library is initialized with license key and user unique identification (user_id). Optionally configuration, user country, and vehicle settings can be set.
let licenseKey : String = "your license key"
let userID = "your user id - unique"
do {
try SygicDriving.sharedInstance().initialize(withClientId: "nrvmkjk1u9.sygic.driverbehaviour.test.ios", userId: userID, licenseKey: licenseKey, configuration: configuration, vehicleSettings: vehicleSettings);
}
catch let error as NSError {
print("Error: \(error.description) \(String(describing: error.localizedRecoverySuggestion))");
}
AppSettings.shared.initializeSygicDrivingValues()
//for release, use .error, for development: .debug
SygicDriving.sharedInstance().setLogLevel(.debug)
SygicDriving.sharedInstance().delegate = self
Configuration
Several options can be provided mainly affecting online interactions with compute server.
let configuration = SygicDrivingConfiguration()
configuration.disableGeofences = false
configuration.dontUploadTrips = false
configuration.sendInRoaming = false
configuration.sendOnMobileData = true
SygicDriving.sharedInstance().update(configuration)
Vehicle settings
Vehicle can optionally be defined. This will affect scoring applied.
let vehicleSettings = SygicVehicleSettings()
vehicleSettings.vehicleType = .car
vehicleSettings.vehicleTrailers = 0
vehicleSettings.vehicleHazmat = false
vehicleSettings.vehicleMaxSpeed = 250
vehicleSettings.vehicleFuelType = .diesel
vehicleSettings.vehicleWeight = 1300
vehicleSettings.vehicleLength = 5434
vehicleSettings.vehicleAxles = 2
SygicDriving.sharedInstance().vehicleSettings = vehicleSettings